Support for Google Oauth2 post G+
See original GitHub issueBelow is an attempt to update providers/oauth2.py
so that it will work with Google login after the shutdown of G+. It works currently with the email and profile scopes.
I’m not sure if it will continue to work post G+ shutdown. 🤞
- user_info_url = 'https://www.googleapis.com/plus/v1/people/me'
+ user_info_url = 'https://www.googleapis.com/oauth2/v1/userinfo'
@staticmethod
def _x_user_parser(user, data):
- emails = data.get('emails', [])
- if emails:
- user.email = emails[0].get('value')
- for email in emails:
- if email.get('type') == 'account':
- user.email = email.get('value')
- break
-
- user.id = data.get('sub') or data.get('id')
- user.name = data.get('displayName')
- user.first_name = data.get('name',{}).get('givenName')
- user.last_name = data.get('name',{}).get('familyName')
- user.locale = data.get('language')
- user.link = data.get('url')
- user.picture = data.get('image',{}).get('url')
+ user.id = data.get('id')
+ user.email = data.get('email')
+ user.name = data.get('name')
+ user.first_name = data.get('given_name')
+ user.last_name = data.get('family_name')
+ user.locale = data.get('locale')
+ user.picture = data.get('picture')
try:
user.birth_date = datetime.datetime.strptime(data.get('birthdate'), "%Y-%m-%d")
- except:
+ except Exception:
user.birth_date = data.get('birthdate')
return user
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Using OAuth 2.0 to Access Google APIs | Authorization
Google supports common OAuth 2.0 scenarios such as those for web server, client-side ... After the user approves access, the response from the...
Read more >Setting up OAuth 2.0 - Google Cloud Platform Console Help
Go to the Google API Console OAuth consent screen page. Add required information like a product name and support email address. Click Add...
Read more >How to Use Google OAuth 2 With a Service Account - Soliant
Learn how to leverage Google OAuth 2 with a service account for your business application from experienced developers at Soliant Consulting.
Read more >Get OAuth 2.0 tokens | Apigee X - Google Cloud
Google Cloud. Overview ... -X POST 'https://apitest.acme.com/oauth/token' \ -d ... For detailed information on scope, see Working with OAuth2 scopes.
Read more >Calling Google APIs via the "HTTP > Make a OAuth 2.0 ...
G Suite Reseller API · Google Sites · Google Apps Script · Gmail API; and many others. from Integromat: Open the Google Cloud...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here: https://github.com/authomatic/authomatic/blob/master/authomatic/providers/oauth2.py#L1253
With the new release, this is solved. Closing this issue.