OAuth for Google App Engine Python
I have carefully read the documentation on how to implement OAuth for GAE Python here: https://cloud.google.com/appengine/docs/python/oauth/#Python_OAuth_and_App_Engine
Following are the next steps. But I have no idea how to make all this work. All I want to do is be able to access https://www.googleapis.com/oauth2/v1/userinfo
so that the user can save his / her email in the ndb app.
Step 1: import oauth
from google.appengine.api import oauth
Step 2: get the current user
user = oauth.get_current_user()
Step 3: Get Request Token https://your_app_id.appspot.com/_ah/OAuthGetRequestToken
Step 4: authorize the token https://your_app_id.appspot.com/_ah/OAuthAuthorizeToken
Step 5: Get Access Token https://your_app_id.appspot.com/_ah/OAuthGetAccessToken
Step 6: get info from google ' https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token=TOKENWOULDGOHERE
I cannot find any good examples that I can use to help me solve this problem. From what I've found, it seems that I always get either an import error or an authentication error. for example
ImportError: No module named oauth2client.client
I would always be grateful if someone could write me a sample or point me in the right direction to just get the user's email address from OAuth2 using GAE Python. Thank you very much!
source to share