Check quietly whether a user is signed in
Let an app find out, without showing any page, whether the user already has a session with the realm.
APIOpenID Connect Core 1.0
An app can sign a user in automatically when they’re already signed in to the realm, and otherwise show its own
Sign in button. It starts a normal sign-in with prompt=none, and the realm never shows a page: the user sees
nothing, whatever the answer, and the app decides what to show next.
Before you start:
- Who can do it: the app’s developer. There’s nothing for a realm administrator to set.
- Where: in the app’s own sign-in request.
- First: register the app for the browser sign-in, as in Sign users in to a web app or Sign users in to a single-page app.
Check for a session
Section titled “Check for a session”-
The app adds
prompt=noneto its usual sign-in request athttps://foobar.cvyuh.com/oauth2/authorize. -
It reads the answer at its return address:
The user… The app receives is signed in and has allowed this app a code, as after any sign-in isn’t signed in login_requiredis signed in, but hasn’t allowed this app what it asks consent_required -
On a code, the app redeems it as usual. On
login_requiredorconsent_required, it shows its Sign in button, which starts a sign-in withoutprompt=none.
Check it worked
Section titled “Check it worked”Open the app in a browser that is signed in to the realm: it should sign you in with no page shown. In a private
window, it should get login_required and show its button.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause | Fix |
|---|---|---|
Always login_required, even when signed in | The browser doesn’t send the realm’s cookie to the app’s frame or redirect, often a third-party cookie block in an embedded frame | Use a top-level redirect, not a hidden frame |
consent_required for a user who allowed the app | The app asks for more scopes than they allowed, or for offline_access, which is asked every time | Ask for the scopes they allowed; leave offline_access for the interactive sign-in |
Undo it
Section titled “Undo it”Stop sending prompt=none. Nothing changes in the realm.
Other prompts
Section titled “Other prompts”prompt= | What it does |
|---|---|
none | Never show a page, as above |
login | Always ask the user to sign in again, even with a session: see Ask users to sign in again |
consent | Always show the consent page, even if the user allowed this before |
Related
Section titled “Related”- Call the API: the conventions every call follows.
- Apps and agents: every endpoint apps and agents call.
- Authorization code with PKCE: the request
promptis part of. - Ask users to sign in again:
max_age,prompt=loginand hints.