我要求我的客户使用其创建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