joelbutcher / socialstream

OAuth for Laravel, simplified.

Home Page:https://docs.socialstream.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with redirect after an OAuthProviderLinkFailedResponse

jamesmills opened this issue · comments

Stack

Jetstream – Livewire

Package Version

5.4

Laravel Version

10

Livewire Version

3

react Version

No response

Vue Version

No response

PHP Version

8.2

Problem description

When trying to connect a Facebook account which has already been attached to another account I'm getting an error from OAuthProviderLinkFailedResponse which is a 404 because it cannot find https://domain.test/profile.show#_=_.

The flow is expected but it looks like this line is not working as intended.

if (class_exists(Jetstream::class)) {
            return redirect()->to('profile.show');
        }

If I comment this out and try again I do get the error message "It looks like this Facebook account is used by another user. Please log in."

Here is a Loom video to show and explain more.

https://www.loom.com/share/9c7d17527cd14c3ea0c026bbe34c035a?sid=9ddc1d48-5e80-4e86-b163-7e4fb229fe43

Thanks in advnce.

Expected behavior

I expected to go to a view that does exist.

Steps to reproduce

https://www.loom.com/share/9c7d17527cd14c3ea0c026bbe34c035a?sid=9ddc1d48-5e80-4e86-b163-7e4fb229fe43

Reproduction repository

https://github.com

Relevant log output

No response

Hey @jamesmills! We're sorry to hear that you've hit this issue. 💙

However, it looks like you forgot to fill in the reproduction repository URL. Can you edit your original post and then we'll look at your issue?

We need a public GitHub repository which contains a Laravel app with the minimal amount of Socialstream code to reproduce the problem. Please do not link to your actual project, what we need instead is a minimal reproduction in a fresh project without any unnecessary code. This means it doesn't matter if your real project is private / confidential, since we want a link to a separate, isolated reproduction. That would allow us to download it and review your bug much easier, so it can be fixed quicker. Please make sure to include a database seeder with everything we need to set the app up quickly.

Can you give me the output of art route:list | grep profile. please?

GET|HEAD  user/profile ................................................................................................................................... profile.show › Laravel\Jetstream › UserProfileController@show
  PUT       user/profile-information ............................................................................................. user-profile-information.update › Laravel\Fortify › ProfileInformationController@update

Does return redirect()->to('profile.show'); expect a "path" and return redirect()->route('profile.show'); expect a "route name" like you're using?

@jamesmills Yep, this was fixed in 6.x, but is a regression for 5.x. Just written a test for this and opened a PR 👍

@jamesmills Yep, this was fixed in 6.x, but is a regression for 5.x. Just written a test for this and opened a PR 👍

I'll upgrade versions when I've upgraded to Laravel 11.

Thanks @joelbutcher and thanks for an awesome package!

On a side note... the error message says "It looks like this GitHub account is used by another user. Please log in.". What does the "Please log in." mean?

@jamesmills it should indicate that the user needs to log in using their existing Laravel profile user. If you feel this is not clear enough, I'd welcome a PR to make it clearer and more succinct.