Acme Accounts

Centralized identity provider for all Acme apps

Step 2: /idp route Checks for Session

Description

The user now lands on the /idp route. Before initializing the OAuth flow, an active session must exist on accounts.acme.com. If a session does not exist (as we will assume in this example), the user will be redirected to /login to create a session.

URL

accounts.acme.com/idp

Visual Preview

Acme Accounts

Acme Accounts could not find a session.

Redirecting to login...

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} />
}

return <B2BIdentityProvider />
Built with v0