# Application sign-in

Use Playbooks OpenID Connect (OIDC) when a hosted application needs to recognize a returning user. The Site’s [visitor policy](/docs/sites/access) controls who can reach the Site. The application decides what each signed-in person can do.

## Set up sign-in

1. In a backend Project, configure your OIDC library with the runtime’s `PLAYBOOKS_OIDC_ISSUER`, `PLAYBOOKS_OIDC_CLIENT_ID`, and `PLAYBOOKS_OIDC_CALLBACK_URL`. Check that the backend can read the issuer’s discovery document at `/.well-known/openid-configuration` and that the sign-in page is reachable from the visitor’s browser.
2. Implement `/auth/callback/playbooks` in your backend. Pass the full `PLAYBOOKS_OIDC_CALLBACK_URL` to the library as its redirect URI. Use the authorization code flow with S256 PKCE and the `openid` scope. Let the library handle discovery, state, nonce, code exchange, and ID token validation.
3. Use the validated issuer and subject to identify the user. Create your own application session and clear it on logout. Use the Site runtime’s configuration when releasing the backend.

## Try a private profile page

Ask the Project to add a **Sign in with Playbooks** button and a profile page that requires an application session. In the working preview, open the profile while signed out, sign in, and return through the callback. Refresh the profile to check that the session persists. Sign out and reopen the same URL to confirm that it requires sign-in again.

Static Sites need a backend for this flow. A Workspace or Site management role alone does not define the visitor’s role inside your application.