Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Laravel Passport: PKCE Flow: Authorization page does not always show up / is inconsistent#37433

Unanswered
prosticoco asked this question inQ&A
Discussion options

Hello, I am trying to implement the PKCE flow and so far I have been able to get tokens. However, the way the redirection works are inconsistent: When I start the PKCE flow (from a react-native android app), the laravel server redirects me to the login page (correct so fare), however after I log in, then sometimes (I do not know what parameter influences this event) I am redirected to the default home page (and therefore I cannot complete the PKCE flow) and some other times, I am correctly redirected to the authorization page (where consent to access the protected API resource is given by the user). I don't understand why this behavior is inconsistent and how to make such that the user is always redirected to the consent page.

consent page :
image

It seems this issue is related to the fact that authenticated users are usually redirected to the home page when they log in outside of a PKCE flow

Thanks in advance for the help and let me know if you need more info

You must be logged in to vote

Replies: 2 comments 1 reply

Comment options

Check the addedprompt parameter on Passport 11.1 - 11.3 when redirecting for authorization:https://laravel.com/docs/9.x/passport#requesting-tokens-redirecting-for-authorization

You must be logged in to vote
0 replies
Comment options

Hello, I am trying to implement the PKCE flow and so far I have been able to get tokens. However, the way the redirection works are inconsistent: When I start the PKCE flow (from a react-native android app), the laravel server redirects me to the login page (correct so fare), however after I log in, then sometimes (I do not know what parameter influences this event) I am redirected to the default home page (and therefore I cannot complete the PKCE flow) and some other times, I am correctly redirected to the authorization page (where consent to access the protected API resource is given by the user). I don't understand why this behavior is inconsistent and how to make such that the user is always redirected to the consent page.

consent page :image

It seems this issue is related to the fact that authenticated users are usually redirected to the home page when they log in outside of a PKCE flow

Thanks in advance for the help and let me know if you need more info

I think I found the answer, for the inconsistent bit after spending many hours analysing what is going on. It lies in the AuthorizationController, approveRequest if condition, in particular the latter clause.

You must be logged in to vote
1 reply
@hafezdivandari
Comment options

This behaviour is already documented:

https://laravel.com/docs/12.x/passport#requesting-tokens-redirecting-for-authorization

Screenshot_20251213_221606_Chrome

In addition:

Screenshot_20251213_222031_Chrome

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
3 participants
@prosticoco@InputOutputZ@hafezdivandari

[8]ページ先頭

©2009-2025 Movatter.jp