<@U04UQ68083H> when using the standard Ory Network...
# ory-copilot
h
@chilly-king-10285 when using the standard Ory Network UI and doing an OIDC login flow, how do I skip “Confirm it’s you” login screen for users that already have an active Ory session?
c
A message from kapa.ai
When you create an OAuth2 client in your Ory Network project, you can configure it to skip the "consent screen", which is the screen where the user must explicitly agree to giving the client access to their data and allow perform operations on their behalf. This approach is useful when you're working with trusted, first-party clients managed by the same entity that manages the Ory Network project. You can turn on skipping the consent screen on a per-client basis through the Ory Console. Here are the steps to enable consent screen skipping for existing OAuth2 clients: 1. Go to OAuth 2OAuth2 Clients in the [Ory Console](https://console.ory.sh/projects/current/oauth). 2. Find the client for which you want to turn on consent skipping and click the pencil icon in the Actions column. 3. Use the Skip consent toggle in the Consent screen section to manage the feature. When you turn this feature on, consent skipping is enabled for the client. 4. Scroll back to the top and click Save. You can also enable consent skipping when you create new OAuth2 clients. Use the Skip consent toggle in the Consent screen section to manage the feature. For more details, please refer to the [Ory documentation](https://www.ory.sh/docs/oauth2-oidc/custom-login-consent/flow#skipping-consent-for-trusted-clients).
h
@chilly-king-10285 I already have
"skip_consent": true
configured for my OIDC client.
c
A message from kapa.ai
If you have already set
"skip_consent": true
for your OIDC client, but you want to skip the "Confirm it's you" login screen for users that already have an active Ory session, you should check the
skip
property of the login request. When you fetch the login request using the
getOAuth2LoginRequest
method, it returns a
loginRequest
object. This object has a
skip
property. If
skip
is
true
, it means the user is already authenticated, and you can accept the login request without showing the login form. Here is a code snippet that shows how to handle this:
Copy code
javascript const challenge = request.query.login_challenge.toString()   const { data: loginRequest } = await ory.getOAuth2LoginRequest({     loginChallenge: challenge.toString(),   })    if (loginRequest.skip) {     // User is already authenticated, don't show the login form and simply accept the login request.     await ory       .acceptOAuth2LoginRequest({         loginChallenge: challenge,         acceptOAuth2LoginRequest: {           subject: loginRequest.subject,         },       })       .then(({ data }) => response.redirect(data.redirect_to))     return   }
In this code, if
loginRequest.skip
is
true
, the login request is accepted without showing the login form, and the user is redirected to the URL specified in
data.redirect_to
. For more details, please refer to the [Ory documentation](https://www.ory.sh/docs/oauth2-oidc/custom-login-consent/flow#login-endpoint-code-example).
h
@chilly-king-10285 but I’m not calling the
getOAuth2LoginRequest
myself. I’m sending the client browser to
/oauth2/auth
and the rest happens on Ory Network backends and UI. How can I control those?
c
A message from kapa.ai
Sorry @handsome-agency-20541, I seem to be having a bit of trouble. Don't worry though, I've pinged my support folks and they will try to fix me up! 🧑‍💻 Perhaps try again in 5mins?
👌 1
h
@chilly-king-10285 any updates? 🙂
c
A message from kapa.ai
I'm sorry, but without a specific context or question, I'm unable to provide an update. Could you please provide more details or clarify what updates you're referring to? Are you asking about updates to Ory's software, updates to a specific issue, or something else?