获取FCM推送通知refresh token需使用什么OAuth授权scope?
解决方案
你需要替换原链接中scope参数的值为 https://www.googleapis.com/auth/firebase.messaging,这是Firebase Push Notification(Firebase云消息/FCM)对应的官方OAuth 2.0授权范围。
替换后完整授权链接示例
https://accounts.google.com/o/oauth2/auth?client_id=CLIENT_ID&scope=https://www.googleapis.com/auth/firebase.messaging&response_type=code&access_type=offline&redirect_uri=urn:ietf:wg:oauth:2.0:oob
额外注意事项
- 你给出的POST请求参数里存在笔误:
redirect_uri参数值少了一个冒号,正确值应为urn:ietf:wg:oauth:2.0:oob,需要和授权链接里的redirect_uri完全一致,否则会触发参数不匹配的报错。 - 后续通过refresh token换取access token、调用FCM推送接口时,均使用上述scope即可正常完成鉴权。
内容的提问来源于stack exchange,提问作者fgohil
相关产品推荐
相关产品推荐

