Android Google API身份验证代码/访问令牌生成:错误400:错误请求
我正在尝试获取一个访问令牌来使用GoogleWebPlayAPI,但它不起作用,也不会给出有用的错误消息,而且Google也没有提供任何支持 刷新令牌: [root@308321~]cat authcode.txt 授权类型=授权-代码和代码=4%2FIAoP7JxYfe82KsuUwQRWQw2na\u vreOM.MtjvGJqCG3IYshQV0ieZDArkfr1icAI&client\u id=37625491467222.apps.googleusercontent.com&client\u secret=XB5gwFt8w29Fs34540gr9urEGEmUHCLI&redirect\u uri=http%3A%2F%2Fwww.kizbit.com%2fauth2callbackAndroid Google API身份验证代码/访问令牌生成:错误400:错误请求,android,oauth,google-play,Android,Oauth,Google Play,我正在尝试获取一个访问令牌来使用GoogleWebPlayAPI,但它不起作用,也不会给出有用的错误消息,而且Google也没有提供任何支持 刷新令牌: [root@308321~]cat authcode.txt 授权类型=授权-代码和代码=4%2FIAoP7JxYfe82KsuUwQRWQw2na\u vreOM.MtjvGJqCG3IYshQV0ieZDArkfr1icAI&client\u id=37625491467222.apps.googleusercontent.com&cli
[root@308321 ~]# wget -S --post-file=authcode.txt https://accounts.google.com/o/oauth2/token
--2012-06-28 01:08:37-- https://accounts.google.com/o/oauth2/token
Resolving accounts.google.com... 2001:4860:b007::54, 74.125.142.84
Connecting to accounts.google.com|2001:4860:b007::54|:443... connected.
HTTP request sent, awaiting response...
HTTP/1.0 400 Bad Request
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Date: Thu, 28 Jun 2012 05:08:40 GMT
Content-Type: application/json
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
2012-06-28 01:08:
37 ERROR 400: Bad Request.
我知道你不应该给钥匙,但这没关系,因为它不起作用
刷新令牌也不起作用
不编码文件也不起作用:
[root@308321 ~]# cat authcode2.txt
grant_type=authorization_code
code=4/IAoP7JxYfe82KsuUwQRWQw2na_vreOM.MtjvGJqCG3IYshQV0ieZDArkfr1icAI
client_id=37625491467222.apps.googleusercontent.com
client_secret=XB5gwFt8w29Fs34540gr9urEGEmUHCLI
redirect_uri=http://www.kizbit.com/oauth2callback
[root@308321 ~]# wget -S --post-file=authcode2.txt https://accounts.google.com/o/oauth2/token
--2012-06-28 01:33:44-- https://accounts.google.com/o/oauth2/token
Resolving accounts.google.com... 2001:4860:b007::54, 74.125.142.84
Connecting to accounts.google.com|2001:4860:b007::54|:443... connected.
HTTP request sent, awaiting response...
HTTP/1.0 400 Bad Request
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Date: Thu, 28 Jun 2012 05:33:47 GMT
Content-Type: application/json
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
2012-06-28 01:33:44 ERROR 400: Bad Request.
我不知道我是怎么解决的。我可能做了一些事情: 从与网页授权请求相同的IP发出访问令牌请求以获取代码。 使用wget-dSO--post文件进行调试。 在网页授权后,快速发出访问令牌请求。也许代码只能持续10米? 在GoogleAPI控制台中向Javascript源代码添加更多IP。 重新URL编码POST文件并去掉任何尾随的换行符。 不管怎么说,一旦我得到了访问令牌和非常重要的刷新令牌,我就很好了
[root@308321 ~]# cat authcode2.txt
grant_type=authorization_code
code=4/IAoP7JxYfe82KsuUwQRWQw2na_vreOM.MtjvGJqCG3IYshQV0ieZDArkfr1icAI
client_id=37625491467222.apps.googleusercontent.com
client_secret=XB5gwFt8w29Fs34540gr9urEGEmUHCLI
redirect_uri=http://www.kizbit.com/oauth2callback
[root@308321 ~]# wget -S --post-file=authcode2.txt https://accounts.google.com/o/oauth2/token
--2012-06-28 01:33:44-- https://accounts.google.com/o/oauth2/token
Resolving accounts.google.com... 2001:4860:b007::54, 74.125.142.84
Connecting to accounts.google.com|2001:4860:b007::54|:443... connected.
HTTP request sent, awaiting response...
HTTP/1.0 400 Bad Request
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Date: Thu, 28 Jun 2012 05:33:47 GMT
Content-Type: application/json
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
2012-06-28 01:33:44 ERROR 400: Bad Request.