Acme Accounts

Centralized identity provider for all Acme apps

Step 4: OAuth Flow Initialized

Description

After successful authentication, the user returns to the /idp route. This time, a valid session exists on accounts.acme.com. The Stytch <B2BIdentityProvider /> component will now initiate the OAuth flow automatically, and the user will be redirected back to acmecalendar.com with an authorization code.

URL

accounts.acme.com/idp

Visual Preview

Acme Accounts

Valid session found

OAuth Flow started. Redirecting to acmecalendar.com...

Example Code

//Use Stytch method to check for valid session
const { member } = useStytchMember();

if (!member) {
  const loginURL = "/login?returnTo=${window.location.toString()}"
  return <Redirect to={loginURL} />
}

// Session exists - proceed with OAuth flow
return <B2BIdentityProvider />
Built with v0