0

我正在调用这个方法:

GoogleTokenResponse accessResposnse = new GoogleAuthorizationCodeTokenRequest(httpTransport, jsonFactory,
                clientId, clientSecret, authorizationUrl, redirectUrl).execute();

其中授权网址是:

String authorizationUrl = new GoogleAuthorizationCodeRequestUrl(clientId, redirectUrl, scope).setAccessType("offline").setState("security_token").setResponseTypes(responseType).build();

但这给了我错误:

com.google.api.client.auth.oauth2.TokenResponseException: 400 错误请求 { "error" : "invalid_grant" }

我错过了中间的任何步骤吗?另外,如果我尝试调用此函数:

AuthorizationCodeResponseUrl authoUrl = new AuthorizationCodeResponseUrl(redirectUrl);

它在扔java.lang.IllegalArgumentException

4

1 回答 1

0

可能是您的刷新令牌已过期..您是尝试使用过期的刷新令牌刷新您的访问令牌还是使用过期的刷新令牌进行 api 调用?- 如果是这样,您需要让您的用户重新进行身份验证..

于 2015-11-24T15:41:25.460 回答