2013-12-09 17 views

回答

2

所以我可以自己回答。在構建google對象時,應該像這樣添加'hd'參數。

google = oauth.remote_app('google', 
         base_url='https://www.google.com/accounts/', 
         authorize_url='https://accounts.google.com/o/oauth2/auth', 
         request_token_url=None, 
         request_token_params={'scope': 'https://www.googleapis.com/auth/userinfo.email', 
              'response_type': 'code', 
              'hd':'domain.com'}, 
         access_token_url='https://accounts.google.com/o/oauth2/token', 
         access_token_method='POST', 
         access_token_params={'grant_type': 'authorization_code'}, 
         consumer_key=GOOGLE_CLIENT_ID, 
         consumer_secret=GOOGLE_CLIENT_SECRET)    
相關問題