You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Google OAuth特定用户无法获取refresh_token问题求助

特定用户无法通过Google OAuth获取refresh_token问题

我们使用以下OAuth授权URL引导用户获取access token:

https://accounts.google.com/o/oauth2/auth?state=14e8d9b8-49c0-498f-b896-02965904737c&client_id={clientId}&response_type=code&redirect_uri={redirect URL}&scope=openid+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fbusiness.manage+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email&access_type=offline

该URL对多数用户生效,但有一位特定用户始终无法获取refresh_token。我们清楚省略access_type=offline参数会导致无法拿到refresh_token,但该参数已包含在URL中,且其他用户的OAuth流程均正常。我们已指导该用户在Google设置的第三方应用连接页面移除我方应用,问题仍未解决。

补充说明:
我们使用Spring RestTemplate获取refresh_token的代码如下:

final HashMap<String, String> request = new HashMap<>();
request.put("grant_type", "authorization_code");
request.put("code", authorizationCode);
request.put("client_id", "{clientId}");
request.put("client_secret", "{clientSecret}");
request.put("redirect_uri", "{callbackUrl}");
var response = this.restTemplate.postForEntity("https://oauth2.googleapis.com/token", request, byte[].class);

内容的提问来源于stack exchange,提问作者Adam Szabo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.18 17:17:02