小编sai*_*und的帖子

错误400:invalid_scope"https://www.googleapis.com/auth/chat.bot"

新谷歌聊天聊天的文档说你需要授权范围https://www.googleapis.com/auth/chat.bot做几乎任何事情.

这是错误:

在此输入图像描述

在使用OAuth2客户端生成身份验证URL时,我收到范围无效的消息.如果我使用https://www.googleapis.com/auth/chatgoogle plus等其他范围,我就没有这个问题.

当我尝试在API资源管理器中搜索内容时,URL或URL部分的组合也不起作用.

这是我获取URL的代码,似乎对其他一切工作正常:

var {google} = require('googleapis');
var OAuth2 = google.auth.OAuth2;

var oauth2Client = new OAuth2(
  "clientid-idididid.apps.googleusercontent.com",
  "_secretsuff",
  "http://localhost:3000/auth/google/callback"
);

var scopes = [
    "https://www.googleapis.com/auth/chat", //Works
    "https://www.googleapis.com/auth/chat.bot"  // Does not work
];

var url = oauth2Client.generateAuthUrl({
  access_type: 'offline',
  scope:  scopes,
});

console.log(url);
Run Code Online (Sandbox Code Playgroud)

google-authentication oauth-2.0 google-oauth2 hangouts-chat

5
推荐指数
1
解决办法
2039
查看次数