Centralized identity provider for all Acme apps
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.
Valid session found
//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 />