我要求我的客戶使用其創建Google API項目的授權gmail帳戶訪問此URL。來自服務器的OAuth2「無效的授權」響應
https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/androidpublisher&response_type=code&access_type=offline&redirect_uri=http://www.XXXXXXXX.com/oauth2callback&client_id=XXXXXX.apps.googleusercontent.com&state=profile&approval_prompt=force
,然後請他給我提供的代碼參數從重定向的URL
http://www.XXXXXXXX.com/oauth2callback?code=4/jUxc2MdX0xmF-b4_I6v2SLMQMuxO.cvQLVEpcJMUXOl05ti8ZT3ZvsT9ddwI
然後我自己張貼此形式以下信息。
<form action="https://accounts.google.com/o/oauth2/token" method="post" >
<input type="hidden" name="grant_type" value="authorization_code" >
<input type="text" name="code" value="**is the one i recieved from previous step**">
<input type="hidden" name="client_id" value="XXXXXXX.apps.googleusercontent.com" >
<input type="hidden" name="client_secret" value="XXXXXXXXXXXX" >
<input type="hidden" name="redirect_uri" value="http://www.XXXXXX.com/oauth2callback" >
<input type="submit" value="Submit">
</form>
,然後我得到以下錯誤
{
"error" : "invalid_grant"
}
當我生成的代碼URL帕拉姆自己和執行下一步。我很成功帶有以下響應
{
"access_token" : "XXXXXXStBkRnGyZ2mUYOLgls7QVBxOg82XhBCFo8UIT5gM",
"token_type" : "Bearer",
"expires_in" : 3600,
"refresh_token" : "XXXXXX3SEBX7F2cfrHcqJEa3KoAHYeXES6nmho"
}
但是,如果客戶端生成URL參數「代碼」,然後我看到無效授予錯誤。
我的客戶在英國,我在另一個國家。任何人都可以確認是否錯誤,因爲客戶端在另一個國家生成代碼參數,我在另一個國家使用該代碼?
在此先感謝。
謝謝你的工作。 – shaikh