Skip to content

Commit 57258e1

Browse files
committed
docs(sso): the OIDC flow uses /sign-in/social and /callback/:id
The OAuth flow section told readers to call POST /api/v1/auth/sign-in/oauth2, a route nothing registers. better-auth's generic-OAuth plugin, which carries the oidcProviders entries, adds no endpoints: it registers each entry as a social provider, so sign-in starts at /sign-in/social with the entry's providerId as `provider` and returns through /callback/:id. Claude-Session: https://claude.ai/code/session_01VDtqoecgES7ScQYGbFVDRv Co-authored-by: Claude <noreply@anthropic.com>
1 parent f243a29 commit 57258e1

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎content/docs/permissions/sso.mdx‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,11 +379,16 @@ The Console `/login` and `/register` pages will now show a button for each enabl
379379
4. Provider redirects to `/api/v1/auth/callback/google`.
380380
5. better-auth creates a session and redirects to `callbackURL`.
381381

382-
**OIDC/enterprise providers**:
382+
**OIDC/enterprise providers** (`oidcProviders`): better-auth's generic-OAuth plugin
383+
registers each one as a social provider and adds no endpoints of its own, so the flow uses
384+
the same two routes as above.
383385
1. User clicks **Continue with Okta SSO**.
384-
2. Client calls `POST /api/v1/auth/sign-in/oauth2` with `{ providerId: "okta", callbackURL }`.
386+
2. Client calls `POST /api/v1/auth/sign-in/social` with `{ provider: "okta", callbackURL }`,
387+
where `provider` is the entry's `providerId`.
385388
3. Browser redirects to the provider's authorization endpoint.
386-
4. Provider redirects back; better-auth validates the OIDC token and creates a session.
389+
4. Provider redirects to `/api/v1/auth/callback/okta`. better-auth exchanges the code, reads
390+
the user's profile from the ID token or `userInfoUrl`, creates a session and redirects to
391+
`callbackURL`.
387392

388393
## Linking to an existing account
389394

0 commit comments

Comments
 (0)