Google Fitness API不征求同意

问题描述 投票:0回答:1

我一直在尝试启动并运行我的Google Fitness API。获取标准信息有效,但是当我想从Fitness API中获取信息时,它将不会注册。看起来好像不想征求许可。

我希望Google通过以下API向用户请求许可Google Consent Screen

[从Google获得访问令牌后,当我转到https://www.googleapis.com/fitness/v1/users/me/dataSources时,邮递员对我说以下话:

{  "error": {
"code": 403,
"message": "Request had insufficient authentication scopes.",
"errors": [
  {
    "message": "Insufficient Permission",
    "domain": "global",
    "reason": "insufficientPermissions"
  }
],
"status": "PERMISSION_DENIED"}}

标题很好,因为我添加了内容类型和授权令牌。我不知道是否与我在Google API中的设置有关?

rest google-api google-oauth
1个回答
0
投票

和我的一个朋友一起,来到了解决方案。

我不知道我用于我的react应用程序的库需要事先了解范围。因此,我要做的是将Scope标记添加到我的登录按钮中,它可以正常工作。

<GoogleLogin
 clientId={CLIENT_ID}
 buttonText='Inloggen'
 onSuccess={this.login}
 onFailure={this.handleLoginFailure}
 cookiePolicy={'none'}
 scope={'https://www.googleapis.com/auth/fitness.activity.read'}
 />
© www.soinside.com 2019 - 2024. All rights reserved.