2013-09-25 17 views
1

以下[https://developers.google.com/accounts/docs/OAuth2InstalledApp] [1]我試圖獲取用戶刷新令牌,但發送請求如下:CORS試圖從谷歌ouath檢索刷新令牌

POST /o/oauth2/token HTTP/1.1 
Host: accounts.google.com 
Content-Type: application/x-www-form-urlencoded 

code=4/v6xr77ewYqhvHSyW6UJ1w7jKwAzu& 
client_id=8819981768.apps.googleusercontent.com& 
client_secret={client_secret}& 
redirect_uri=https://oauth2-login-demo.appspot.com/code& 
grant_type=authorization_code 

我收到cors問題 - Access-Control-Allow-Origin不允許。

有沒有人有這個問題?

回答

1

請記住刷新標記不打算在客戶端代碼中使用。特別是,您以這種方式披露您的客戶機密。刷新令牌只能用於服務器端代碼,在這裏你不會被瀏覽器執行的原始控件綁定。

+0

太傷心了doc不能這麼說... https://developers.google.com/youtube/2.0/developers_guide_protocol_oauth2#OAuth2_Refreshing_a_Token –

相關問題