Skip to content
This repository has been archived by the owner on Jun 4, 2019. It is now read-only.

Commit

Permalink
Deprecate Google+ API and promote new Google OAuth2
Browse files Browse the repository at this point in the history
This change removes the deprecation warning on the Google Sign In, and modifies the API endpoints according to the latest Google documentation. Then places a deprecation warning on the Google+ (googleplus) provider to to its shutdown.
  • Loading branch information
markuso committed Feb 1, 2019
1 parent b9243af commit 07606b5
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions simpleauth/handler.py
Expand Up @@ -80,11 +80,11 @@ class SimpleAuthHandler(object):
PROVIDERS = {
# OAuth 2.0 providers
'google': (OAUTH2,
'https://accounts.google.com/o/oauth2/auth?{0}',
'https://accounts.google.com/o/oauth2/token'),
'https://accounts.google.com/o/oauth2/v2/auth?{0}',
'https://www.googleapis.com/oauth2/v4/token'),
'googleplus': (OAUTH2,
'https://accounts.google.com/o/oauth2/auth?{0}',
'https://accounts.google.com/o/oauth2/token'),
'https://accounts.google.com/o/oauth2/v2/auth?{0}',
'https://www.googleapis.com/oauth2/v4/token'),
'windows_live': (OAUTH2,
'https://login.live.com/oauth20_authorize.srf?{0}',
'https://login.live.com/oauth20_token.srf'),
Expand Down Expand Up @@ -421,13 +421,10 @@ def _get_optional_params_for(self, provider):
def _get_google_user_info(self, auth_info, key=None, secret=None):
"""Returns a dict of currenly logging in user.
Google API endpoint:
https://www.googleapis.com/oauth2/v3/userinfo
https://www.googleapis.com/userinfo/v2/me
"""
logging.warn('Google userinfo endpoint is deprecated. '
'Use Google+ API (googleplus provider): '
'https://developers.google.com/+/api/auth-migration#timetable')
resp = self._oauth2_request(
'https://www.googleapis.com/oauth2/v3/userinfo?{0}',
'https://www.googleapis.com/userinfo/v2/me?{0}',
auth_info['access_token'])
data = json.loads(resp)
if 'id' not in data and 'sub' in data:
Expand All @@ -439,6 +436,9 @@ def _get_googleplus_user_info(self, auth_info, key=None, secret=None):
Google+ API endpoint:
https://www.googleapis.com/plus/v1/people/me
"""
logging.warn('Google+ API endpoint is deprecated. '
'Use Google API (google provider): '
'https://developers.google.com/+/api-shutdown')
resp = self._oauth2_request(
'https://www.googleapis.com/plus/v1/people/me?{0}',
auth_info['access_token'])
Expand Down

0 comments on commit 07606b5

Please sign in to comment.