python from oauth2client.client import OAuth2WebServerFlow CLIENT_ID = 'your-client-id' CLIENT_SECRET = 'your-client-secret' REDIRECT_URI = 'http://example.com/callback' AUTHORIZATION_URL = 'http://example.com/authorization' TOKEN_URL = 'http://example.com/token' SCOPE = 'profile' flow = OAuth2WebServerFlow(client_id=CLIENT_ID, client_secret=CLIENT_SECRET, scope=SCOPE, redirect_uri=REDIRECT_URI, auth_uri=AUTHORIZATION_URL, token_uri=TOKEN_URL) auth_url = flow.step1_get_authorize_url() # ... credentials = flow.step2_exchange(authorization_code) # ...


上一篇:
下一篇:
切换中文