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

[4.0] Handle Google responses excluding 'name' #340

Merged
merged 1 commit into from
Feb 10, 2019
Merged

[4.0] Handle Google responses excluding 'name' #340

merged 1 commit into from
Feb 10, 2019

Conversation

derekmd
Copy link
Contributor

@derekmd derekmd commented Feb 9, 2019

I just had a Google login callback in production throw an exception because the 'name' JSON key was missing in the payload. Generally this would be a full response body:

{
  "id": "1008...",
  "email": "derek...@...",
  "verified_email": true,
  "name": "Derek M...",
  "given_name": "Derek",
  "family_name": "M...",
  "link": "...",
  "picture": "...",
  "locale": "en",
}

But for incomplete (or service migrated?) accounts Google may exclude some keys. I can't find complete documentation covering how this OAuth2 scope is supposed to behave. They only offer a live-fetch form: https://developers.google.com/apis-explorer/#search/userinfo/m/oauth2/v2/oauth2.userinfo.v2.me.get

Socialite's 3.0 branch already handles this field as optional: https://github.com/laravel/socialite/pull/319/files#diff-2adaa1ef0c311c4b988908f120ea7557R84

It's possible for Google's API response
to exclude the 'name' key in its JSON
payload.
@taylorotwell taylorotwell merged commit 241438e into laravel:4.0 Feb 10, 2019
@derekmd derekmd deleted the google-payload-name-is-optional branch February 14, 2019 22:16
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.

2 participants