Skip to content

Conversation

@joelbutcher
Copy link
Owner

This PR allows developers to override how a user is prompted to confirm a connection with an OAuth provider when they are logged in.

Simply pass a closure to Socialstream::promptOAuthLinkUsing(...) that returns either view(...) or Inertia::render(...) inside the boot method of your AppServiceProvider:

Livewire / Blade

public function boot(): void
{
    Socialstream::promptOAuthLinkUsing(
        fn (string $provider) => view('pages.auth.oauth.confirm-link-provider', ['provider' => $provider])
    );
}

Inertia

public function boot(): void
{
    Socialstream::promptOAuthLinkUsing(
        fn (string $provider) => Inertia::render('Auth/OAuth/ConfirmLinkProvider', ['provider' => $provider])
    );
}

@joelbutcher joelbutcher merged commit 3cfd9af into 6.x Feb 14, 2025
38 checks passed
@joelbutcher joelbutcher deleted the task/allow-custom-oauth-link-prompt-callback branch February 14, 2025 15:08
@miguilimzero
Copy link
Contributor

@joelbutcher when using this implementation on my project, is throwing a Cannot access offset of type Closure in isset or empty exception:

image

@joelbutcher
Copy link
Owner Author

What did you register as the custom prompt?

@miguilimzero
Copy link
Contributor

AppServiceProvider -> boot()

Socialstream::promptOAuthLinkUsing(
    function (string $provider) {
         return Inertia::render('Auth/ConfirmLinkProvider', ['provider' => $provider]);
    }
);

@joelbutcher
Copy link
Owner Author

@miguilimzero This is fixed in the latest patch release for 6.x.

Please update to this version.

@miguilimzero
Copy link
Contributor

Now it's working as expected 🎉

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

Successfully merging this pull request may close these issues.

3 participants