Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passport doesn't redirect back to authorization form after login #248

Closed
ingria opened this issue Jan 25, 2017 · 11 comments
Closed

Passport doesn't redirect back to authorization form after login #248

ingria opened this issue Jan 25, 2017 · 11 comments

Comments

@ingria
Copy link

ingria commented Jan 25, 2017

My flow:

  1. Unauthorized user clicks on the "Login via MyService" button on client.tld
  2. User is redirected to the authorization form on myservice.tld/oauth/authorize?client_id=...
  3. As the user is not logged in, he's redirected to myservice.tld/login
  4. User logs in
  5. User is redirected to myservice.tld

The problem:

How do I make the user to be redirected back to step 2 after step 4? So that he sees the authorization form immediately after logging in? Like that:

...
4. User logs in
5. User is redirected to the authorization form
6. User presses 'Allow' or 'Deny' button
7. User is redirected back to client.tld/login/MyService/calback...

I'm using passport v1.0.17. In my login controller I'm using something like this:

public function proceed()
{
    return redirect()->intended('/');
}
@ccostel
Copy link

ccostel commented Feb 27, 2017

Did you manage to find more information on this? I am having the same issue. Does one have to write his own integration?

@ingria
Copy link
Author

ingria commented Mar 2, 2017

Nope 😔

I cannot even determine which step inside the app breaks that normal flow. Hope someone from contributors will clarify.

@ingria
Copy link
Author

ingria commented Mar 10, 2017

UPD: Weird thing, seems like everything works fine in mobile Safari and mobile Chrome, but not on any desktop browser 🤔

@themsaid
Copy link
Member

themsaid commented Jul 5, 2017

Closing for lack of activity, hope you got the help you needed :)

@themsaid themsaid closed this as completed Jul 5, 2017
@ingria
Copy link
Author

ingria commented Jul 6, 2017

Nope, then I would have closed this issue myself. This issue is still actual.

@ghost
Copy link

ghost commented Apr 4, 2018

same here 6 months later. whenever one of my users wants to log into a socialite site they get redirected to the main site that uses passport but if they aint logged into the main site they get sent to the login page but once they login they stay on the main site. like to be able to redirect them back to the passport oauth page once they log in.
Can do @if(request()->has('authurl')) where authurl would be the authorization url from socialite then can redirect back to that by putting authurl in a hidden input field.

@BrandOriented
Copy link

I have this same issue. Problem only on chrome(tested from 64-67).
If I enter through the link directly in the new tab, the problem does not occur, but if it is in the same card, laravel gets an invalid url()->previous()

@SamyOteroGlez
Copy link

Any updates on this one?

@kresnasatya
Copy link

kresnasatya commented Nov 9, 2019

Hi, I just solve the problem and provide the gist below:

Fixed problem Laravel Passport doesn't redirect back to authorization form after login

I hope it helps you all.

@ingria
Copy link
Author

ingria commented Nov 9, 2019

@satyakresna, cool 👍. @themsaid please pay attention

@pogush
Copy link

pogush commented Jan 29, 2021

I had this very same issue while trying Passport with Laravel 8 and Breeze.

Fixed by changing the store(LoginRequest $request) function in AuthenticatedSessionController to return

return redirect()->intended(RouteServiceProvider::HOME)

I also made the same change in the RedirectIfAuthenticated.

This seems more like a Breeze issue/enhancement by the way, but figured it could help someone else if I posted this here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants