# Login with Link (auth back-end only)

*For now, all responsibilty for anything breaking should be directed to <m@rkmoriarty.com>.*

### Questions?

* If you work at Stripe: Ask questions on #login-with-link.&#x20;
* Otherwise, email <markmoriarty+loginwithlink@stripe.com> 👋

## Sunday 5/22: These docs will describe how to use this via API only.&#x20;

You will bring your own session management library (e.g., authjs.dev, as used on shop.markmoriarty.com)

The main steps are quite simple:

1. `/lookup`  Collect a user's email for login or signup: Look up this email to see if the email exists on the Link network. We will send you a `client_secret` in our response.

*(If the user does NOT exist on Link: invite them to sign up for Link. Otherwise, continue with the below.)*

* `/start_verification` If the user does exist on Stripe: ask Stripe to send them the SMS verification code.&#x20;

2. `/authenticate` Collect the 6-digit code from the user using a form of your own design. Submit this to Stripe, along with the \`client\_secret\` we sent you in step 1.

Click "next" to view instructions to use API only: <https://docs.loginwithlink.com/use-api-only/about-this-option-api-only>&#x20;

## In a few days(?): Plausibly I could spin up a basic OIDC provider

Redirect from your site to a Stripe-hosted "Login with Link/Stripe" page, just like you'd do for "Log in with Twitter" or "Log in with GitHub".&#x20;

Wish: rally >1 other Stripes to have other session-management front-ends (ideally not also using next-auth.js), using this new (minimal) OIDC provider. This should help demonstrate (to less technical folks) how to separate "Login with Link" (as just OIDC) from "session management" (using libraries like next-auth, firebase, supabase, etc.)

Based on today's research, it seems quite doable. Stripe out the front-end pages like /users, and do a redirect instead of log in action, so developer can B.Y.O. session management library: [read more](https://docs.loginwithlink.com/oidc-oauth-hosted-login-page/about-this-option-open-id-connect-oidc).<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.loginwithlink.com/login-with-link-auth-back-end-only.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
