0

我使用Google tutorial來獲取我的web應用程序的訪問令牌。但在下面的步驟:如何獲得谷歌授權代碼

  1. Web應用程序將用戶重定向到谷歌授權頁面
  2. 用戶授予Web應用程序訪問
  3. 谷歌將用戶重定向回你的Web應用程序,並返回一個授權碼

我不知道如何獲得此授權碼?其實在我的Python代碼我不知道怎麼去「AUTH_CODE」

data = urllib.urlencode({ 
'code': auth_code, 
'client_id': client_id, 
    'client_secret': client_secret, 
'redirect_uri': redirect_uri, 
'grant_type': 'authorization_code' 
    }) 
+0

您可以嘗試請從此頁面開始:https://developers.google.com/api-client-library/python/guide/aaa_oauth – some1

回答

0

,我發現我的解決方案:) 我應該過去的網址,我的瀏覽器,並獲取代碼

print '%s?client_id=%s&redirect_uri=%s&scope=%s&response_type=code' % \ 
    ('https://accounts.google.com/o/oauth2/auth', 
    clientID, 
    redirect_uri, 
    'https://www.googleapis.com/auth/fusiontables')