laravel / socialite

Laravel wrapper around OAuth 1 & OAuth 2 libraries.
https://laravel.com/docs/socialite
MIT License
5.58k stars 940 forks source link

Google driver not passing custom params to callback URL #714

Closed sts-ryan-holton closed 1 month ago

sts-ryan-holton commented 2 months ago

Socialite Version

5.16.0

Laravel Version

11.21.0

PHP Version

8.3.9

Database Driver & Version

MySQL 8

Description

Custom with params aren't passed back to the callback URL on google driver

Steps To Reproduce

Use Google driver

Socialite::driver('google')->scopes([
    'https://www.googleapis.com/auth/calendar'
])->with(array_merge(['access_type' => 'offline'], [
    'should_activate_integration' => true,
    'integration_id' => 'my-id'
]))->redirect(),

Within my callback controller I'm using an invoke method accepting in the Request $request, and I don't see my integration_id or other options here:

$googleUser = Socialite::driver($service)->stateless()->user();

\Log::info('req', [
            'intit' => $request->input('integration_id', 'none'),
            'req' => $request->all()
        ]);
github-actions[bot] commented 2 months ago

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

ev-gor commented 2 months ago

Google OAuth API doesn't support 'integration_id' query string parameter. It supports 'state' parameter and returns 'state' in the response.

sts-ryan-holton commented 2 months ago

I ended up passing it in via state just for the Google drvier

crynobone commented 1 month ago

We are closing this as an alternative solution available. However, anyone is free to submit PR if any improvements need to be made.