【问题标题】:how to refresh google access token with refresh token without SSL?如何在没有 SSL 的情况下使用刷新令牌刷新谷歌访问令牌?
【发布时间】:2018-10-14 12:17:49
【问题描述】:

我在服务器端刷新 google 访问令牌时遇到问题。

        RestTemplate restTemplate = new RestTemplate();

        MultiValueMap<String, String> params = new LinkedMultiValueMap();

        params.add("client_id", clientSecrets.getDetails().getClientId());
        params.add("client_secret", clientSecrets.getDetails().getClientSecret());
        params.add("refresh_token", this.refreshToken);
        params.add("grant_type", "refresh_token");

        String result = restTemplate.postForObject(requestUrl, params, String.class);

我从谷歌身份验证服务器得到的响应只是 403 状态码。 和消息是这样的

{"error":"internal_failure","error_description":"SSL is required to perform this operation."}

为了刷新访问令牌是否必须在我的服务器上使用 SSL? 它已经在我的本地服务器上进行了测试,并且没有附加任何 SSL。

此代码的参考来自以下 URL。 https://developers.google.com/identity/protocols/OAuth2WebServer#offline

【问题讨论】:

  • 我通过为 google api 添加 'https' 协议而不是 'http' 协议解决了这个问题

标签: authentication access-token refresh-token


【解决方案1】:

我通过为 google api 添加“https”协议而不是“http”协议解决了这个问题

我打过电话

http://www.googleapis.com/oauth2/v4/token

但对于 SSL 调用

https://www.googleapis.com/oauth2/v4/token

需要刷新访问令牌

【讨论】:

    猜你喜欢
    • 2020-02-27
    • 2014-01-11
    • 2016-06-15
    • 2020-07-12
    • 2019-06-29
    • 2021-01-29
    • 2013-07-20
    • 1970-01-01
    • 2022-10-31
    相关资源
    最近更新 更多