bland-finland-95044
08/29/2025, 4:28 PMchilly-king-10285
08/29/2025, 4:28 PMchilly-king-10285
08/29/2025, 4:28 PMskip
flag or the client.skip_consent
property. - If either is true
, the consent request is accepted automatically, and the requested scopes are granted without showing the UI to the user. Example logic from the documentation: typescript const skipConsent = challenge.skip || // skip because the user accepted the consent previously challenge.client.skip_consent // skip because the client is trusted if (skipConsent) { // If the consent is skipped, we accept the consent request immediately. await oauth2.acceptOAuth2ConsentRequest({ consentChallenge: String(consent_challenge), acceptOAuth2ConsentRequest: { grant_scope: challenge.requested_scope, grant_access_token_audience: challenge.requested_access_token_audience, session, }, }) }
So, yes: when "Skip consent screen" is enabled, the client will automatically get all the requested scopes for each consent request, provided the user is authenticated and the request is valid [Skip consent and logout consent](https://www.ory.sh/docs/oauth2-oidc/skip-consent) [Custom-login-consent flow: Consent](https://www.ory.sh/docs/oauth2-oidc/custom-login-consent/flow#consent).bland-finland-95044
08/29/2025, 4:51 PMchilly-king-10285
08/29/2025, 4:52 PMchilly-king-10285
08/29/2025, 4:52 PMsession.cookie.persistent: false
, the session cookie will not persist across browser restarts or new tabs, which can cause unexpected logins [Session lifespan](https://www.ory.sh/docs/kratos/session-management/session-lifespan). - Prompt Parameter: If the OAuth2 request includes prompt=login
or max_age=0
, Ory will force a re-authentication even if a session exists [OAuth2 authorization code flow](https://www.ory.sh/docs/oauth2-oidc/authorization-code-flow). - Cross-Origin Issues: If Salesforce and the other application are on different domains and the session cookie is not set with the correct domain/same-site attributes, the cookie may not be sent with the SSO request [Check session status](https://www.ory.sh/docs/identities/sign-in/check-session-token-cookie-api). In summary, as long as the session cookie is valid, present, and properly configured, the user should not be prompted to log in again when accessing Salesforce via SSO. If you are seeing repeated login prompts, check your session cookie configuration, domain settings, and the parameters used in the OAuth2 flow.bland-finland-95044
08/29/2025, 5:17 PMchilly-king-10285
08/29/2025, 5:17 PMchilly-king-10285
08/29/2025, 5:17 PM/oauth2/auth
endpoint was called. This is indicated by the 302 redirect to /ui/login?login_challenge=...
, which is the standard behavior when no valid session is found [User login and consent flow](https://www.ory.sh/docs/oauth2-oidc/custom-login-consent/flow#flow-steps). Here are the most likely reasons for this, based on the knowledge sources: 1. Session Cookie Not Present or Not Valid: Ory checks for a session cookie to determine if the user is already authenticated. If the session cookie is missing, expired, or invalid, Ory will redirect to the login UI [Session management](https://www.ory.sh/docs/identities/get-started/session-management) [Session lifespan](https://www.ory.sh/docs/kratos/session-management/session-lifespan). 2. Cookie Domain or SameSite Issues: If the session cookie is not set with the correct domain or SameSite attributes, it may not be sent with the request to the Ory endpoint, especially if the SSO flow is initiated from a different domain or subdomain. This would prevent Ory from recognizing the session [Check session status](https://www.ory.sh/docs/identities/sign-in/check-session-token-cookie-api). 3. Session Expired: If the session lifespan has expired, the user must re-authenticate. The session lifespan is configurable, and if set too short, users may be prompted to log in more frequently [Session lifespan](https://www.ory.sh/docs/kratos/session-management/session-lifespan). 4. Prompt Parameter or max_age: If the OAuth2 request includes prompt=login
or max_age=0
, Ory will force a re-authentication even if a session exists. However, your request does not include these parameters, so this is less likely in this case [OAuth2 authorization code flow](https://www.ory.sh/docs/oauth2-oidc/authorization-code-flow). 5. Cookie Mixup or Misconfiguration: There have been reports where a cookie mixup or misconfiguration in the application caused Ory not to recognize the session, resulting in repeated login prompts. Ensuring that the correct cookies are present and not overwritten or deleted is important [Github Issue: Infinite login loop](https://github.com/ory/network/issues/334). Summary: The most probable cause, given your request and response, is that the Ory session cookie was either not present, not valid, or not sent with the request to the Ory /oauth2/auth
endpoint. This caused Ory to redirect the user to the login page to establish a new session. Double-check your session cookie configuration, domain settings, and ensure that the browser is sending the correct cookies with the SSO request. If you need to debug further, use browser developer tools to inspect which cookies are being sent with the request and verify their validity and scope [CSRF troubleshooting](https://www.ory.sh/docs/troubleshooting/csrf#ory-oauth2).bland-finland-95044
08/29/2025, 5:33 PMchilly-king-10285
08/29/2025, 5:33 PMchilly-king-10285
08/29/2025, 5:33 PMgetOAuth2LoginRequest
) to retrieve the relevant information [Ory OAuth2 login flow](https://www.ory.sh/docs/oauth2-oidc/custom-login-consent/flow#login-endpoint-code-example) [Ory API Reference: getOAuth2LoginRequest](https://raw.githubusercontent.com/ory/docs/master/docs/reference/api.json). If you need details about the login request, you should use the login challenge with the Ory API rather than attempting to decode it yourself.bland-finland-95044
08/29/2025, 6:01 PMchilly-king-10285
08/29/2025, 6:01 PMchilly-king-10285
08/29/2025, 6:01 PMprompt=login
or max_age=0
), though you did not mention these in your scenario. The expected behavior is: 1. The browser is redirected to the login endpoint. 2. The login endpoint checks for a valid session cookie. 3. If a valid session exists, the user is not prompted to log in again. If this is not happening, it is likely due to one of the issues above. The knowledge sources do not provide a more specific reason for this behavior beyond these common causes [Check session status](https://www.ory.sh/docs/identities/sign-in/check-session-token-cookie-api) [Session lifespan](https://www.ory.sh/docs/kratos/session-management/session-lifespan).bland-finland-95044
08/29/2025, 6:15 PMchilly-king-10285
08/29/2025, 6:15 PMchilly-king-10285
08/29/2025, 6:16 PM/oauth2/auth
for the second application. 2. The session cookie must be sent with the request to the Ory endpoints. This requires: - The cookie domain and path are set correctly (should be shared across the apps). - The SameSite attribute allows the cookie to be sent (often Lax
or None
for cross-site SSO). - The cookie is not expired. If the user is still being redirected to the Ory Account Experience (login UI) when accessing /oauth2/auth
, it means Ory is not detecting a valid session. This is typically due to one of the following: - Cookie not sent: The browser is not sending the ory_session_<project>
cookie with the request to Ory. This can happen if the domain, path, or SameSite attributes are not set to allow sharing between your applications and Ory. - Session expired or invalid: The session cookie is expired or otherwise invalid. - Configuration issue: The Ory project may be configured with a non-persistent session (session.cookie.persistent: false
), which means the session does not persist across browser restarts or new tabs, causing unexpected logouts [Session lifespan](https://www.ory.sh/docs/kratos/session-management/session-lifespan). - Cross-domain issues: If your applications and Ory are on different subdomains or domains, ensure the cookie domain is set to a common parent domain and SameSite is set appropriately [Check session status](https://www.ory.sh/docs/identities/sign-in/check-session-token-cookie-api). How to address this: - Ensure your session cookie is configured to be shared across all relevant domains/subdomains. - Set the cookie domain to the parent domain (e.g., .<http://yourdomain.com|yourdomain.com>
). - Set SameSite to Lax
or None
(with Secure
if using None
). - Make sure the session is persistent if you want SSO across tabs and browser restarts (session.cookie.persistent: true
). - Use browser developer tools to confirm that the ory_session_<project>
cookie is present and sent with requests to Ory endpoints. If all of these are configured correctly, Ory should detect the existing session and not prompt the user to log in again when accessing another application [Session management](https://www.ory.sh/docs/identities/get-started/session-management) [Session lifespan](https://www.ory.sh/docs/kratos/session-management/session-lifespan). If you have verified all of the above and the issue persists, there may be a more specific configuration or environment issue not covered in the knowledge sources.bland-finland-95044
08/29/2025, 8:04 PMchilly-king-10285
08/29/2025, 8:05 PMchilly-king-10285
08/29/2025, 8:05 PMskip
is false
in your getOAuth2LoginRequest
response, even though the status is OK, is because Ory determines the value of skip
based on whether the user has an active session and whether the client, user, and requested scopes match a previous, remembered login. If any of these conditions are not met, skip
will be false
, and the login UI will be shown. From the knowledge sources: - The skip
value is true
only if the user is already authenticated and the client has previously requested the same scopes from the same user, and the session is still valid. If not, the login UI must be shown ([Custom-login-consent flow: Login](https://www.ory.sh/docs/oauth2-oidc/custom-login-consent/flow#login-endpoint-code-example)). - The login flow always redirects to the login endpoint, but the login endpoint itself checks if a valid session exists. If so, it can accept the login request immediately; otherwise, it shows the login UI. The skip
flag in the login request tells you whether you can skip the UI or not ([Custom-login-consent flow: Login](https://www.ory.sh/docs/oauth2-oidc/custom-login-consent/flow#login-endpoint-code-example)). - The skip
flag is not affected by the client’s skip_consent
setting. That setting only affects the consent step, not the login step ([Custom-login-consent flow: Consent](https://www.ory.sh/docs/oauth2-oidc/custom-login-consent/flow#consent)). So, even if the status is OK, skip
will be false
if: - The user does not have a valid, active session (e.g., session cookie missing, expired, or not sent). - The login flow requires re-authentication (e.g., due to prompt=login
or max_age
). - The login request is for a new client, new scopes, or a different user. Summary: skip: false
means Ory did not detect a valid session for this login request, so the login UI should be shown. This is expected behavior if the session is not valid or not present, regardless of the HTTP status code. If you believe the user does have a valid session, check that the session cookie is present, valid, and sent with the request to Ory, and that no parameters are forcing re-authentication ([Session management](https://www.ory.sh/docs/identities/get-started/session-management)).bland-finland-95044
08/29/2025, 8:14 PMgetOAuth2LoginRequest
in the same browser, should that succeed or fail? Assuming they have a session cookie valid for the appropriate domainschilly-king-10285
08/29/2025, 8:14 PMchilly-king-10285
08/29/2025, 8:15 PMgetOAuth2LoginRequest
in the same browser, and they have a valid session cookie for the appropriate domains, the request should succeed. Ory will detect the valid session cookie and return the login request context. In this case, the skip
flag in the response may be true
, indicating that the user is already authenticated and the login UI can be skipped, or false
if additional authentication is required (for example, if the requested scopes or client differ, or if re-authentication is forced by parameters like prompt=login
or max_age
). The key requirement is that the session cookie must be present, valid, and sent with the request to Ory. If these conditions are met, the getOAuth2LoginRequest
call will return the login request context as expected [Custom-login-consent flow: Login](https://www.ory.sh/docs/oauth2-oidc/custom-login-consent/flow#login-endpoint-code-example). If the session cookie is missing, expired, or not sent, the request will still succeed (HTTP 200), but the response will indicate that the user is not authenticated (e.g., skip: false
), and the login UI should be shown.bland-finland-95044
08/29/2025, 8:16 PMgetOAuth2LoginRequest
in the same browser, should that succeed or fail? What if the oauth client is requesting scopes like email
and we have skip consent turned on? Assuming they have a session cookie valid for the appropriate domainschilly-king-10285
08/29/2025, 8:16 PMchilly-king-10285
08/29/2025, 8:16 PMgetOAuth2LoginRequest
in the same browser, and they have a valid session cookie for the appropriate domains, the request to getOAuth2LoginRequest
should succeed. Ory will detect the valid session and return the login request context. The skip
flag in the response will be true
if the user is already authenticated and the login can be skipped; otherwise, it will be false
and the login UI should be shown [Custom-login-consent flow: Login](https://www.ory.sh/docs/oauth2-oidc/custom-login-consent/flow#login-endpoint-code-example). If the OAuth client is requesting scopes like email
and you have "skip consent" turned on, this affects the consent step, not the login step. The "skip consent" setting means that, after login, the consent screen will be skipped and the requested scopes (such as email
) will be granted automatically. However, it does not affect whether the login UI is shown; that is determined by whether a valid session exists and the parameters of the login request [Custom-login-consent flow: Consent](https://www.ory.sh/docs/oauth2-oidc/custom-login-consent/flow#consent). Summary: - getOAuth2LoginRequest
will succeed if the session cookie is valid and present. - "Skip consent" only affects the consent step, not the login step. - The login UI is skipped if the user is already authenticated and no parameters force re-authentication. If the session cookie is missing, expired, or not sent, the login UI will be shown even if "skip consent" is enabled for the client.bland-finland-95044
08/29/2025, 8:26 PMchilly-king-10285
08/29/2025, 8:26 PMchilly-king-10285
08/29/2025, 8:26 PMgetOAuth2LoginRequest
provides a way to see why the skip
property was determined to be false
. The documentation and API references describe the presence of the skip
flag and its meaning (i.e., whether the login UI can be skipped), but they do not mention any field or mechanism in the API response that explains the reasoning behind its value. You can only infer the reason based on session presence, requested scopes, client configuration, and request parameters, but the API itself does not return a detailed explanation for the skip
decision [Custom-login-consent flow: Login](https://www.ory.sh/docs/oauth2-oidc/custom-login-consent/flow#login-endpoint-code-example).