goauthentik / authentik

The authentication glue you need.
https://goauthentik.io
Other
13.75k stars 926 forks source link

need to login twice for oauth2 provider if there is a parameter `prompt=login` #12182

Open j-z10 opened 3 days ago

j-z10 commented 3 days ago

Describe the bug When the query parameter prompt=login is included in an OAuth2 provider request and the user is not logged in, the user is required to log in twice to complete the OAuth2 login process. maybe we should overwrite the function, remove the prompt=login before redirecting to authentication flow if we haven't logged in yet.

To Reproduce Steps to reproduce the behavior:

  1. Create an application with an Oauth2 provider
  2. Ensure the user is signed out.
  3. Visit /application/o/authorize/?client_id=xx&redirect_uri=xx&response_type=code&prompt=login
  4. You will first be redirected to the default authentication flow to log in.
  5. After logging in, you will be redirected back to the original /application/o/authorize/ URL.
  6. Since the prompt=login query parameter is still present, you will be redirected to the login flow again.
  7. Once you log in this second time, you will finally be redirected to the specified redirect_uri.

Expected behavior Should login once and redirect to redirec_uri we specified

Version and Deployment (please complete the following information):

Additional context Add any other context about the problem here.