这是我到目前为止所得到的。
GOOGLE_AUTH_URI = 'https://accounts.google.com/o/oauth2/auth'
GOOGLE_REVOKE_URI = 'https://accounts.google.com/o/oauth2/revoke'
GOOGLE_TOKEN_URI = 'https://accounts.google.com/o/oauth2/token'
GOOGLE_BASE_URL = 'https://www.googleapis.com/plus/v1/'
redirect_uri = '127.0.0.1:5000/callback'
google = OAuth2Service(
name='google',
client_id = GOOGLE_APP_ID,
client_secret = GOOGLE_APP_SECRET,
access_token_url=GOOGLE_TOKEN_URI,
authorize_url=GOOGLE_AUTH_URI,
base_url = GOOGLE_BASE_URL)
@app.route('/login/google')
def googleLogin():
params = {'scope': 'https://www.googleapis.com/auth/userinfo.profile',
'access_type': 'offline',
'response_type': 'code',
'redirect_uri': redirect_uri}
return redirect(google.get_authorize_url(**params))
@app.route('/callback')
def callback():
credentials = google.get_access_token(data = {'code':request.args['code'],
'grant_type': 'authorization_code',
'redirect_uri': redirect_uri},
decoder = json.loads)
return jsonify(refresh_token=credentials)
现在我想在用户在我的数据库中同意后存储用户信息。我应该怎么做呢?