错误400:invalid_scope"https://www.googleapis.com/auth/chat.bot" [英] Error 400: invalid_scope "https://www.googleapis.com/auth/chat.bot"

查看:173
本文介绍了错误400:invalid_scope"https://www.googleapis.com/auth/chat.bot"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关新版Google hangouts聊天的文档说,您需要授权范围 https://www.googleapis.com/auth/chat.bot 可以执行几乎所有操作.

The documentation for the new google hangouts chat says that you need to authorize the scope https://www.googleapis.com/auth/chat.bot to do pretty much anything.

这是错误:

使用其 OAuth2客户端我收到范围无效的消息.如果我使用 https://www.googleapis.com/auth/chat https://www.googleapis.com/auth/chat a>或其他一些范围,例如 google plus .

While generating an authentication URL using their OAuth2 client I get the message that the scope is invalid. I don't have that problem if I use https://www.googleapis.com/auth/chat or some other scope like the one for google plus.

当我尝试在 API资源管理器,URL的组合或部分URL都不起作用.

When I try to google things on in the API Explorer no combination of the URL or parts of the URL work either.

这是我获取网址的代码,对于其他所有功能似乎都可以正常工作

Here is my code to fetch the URL, seems to work just fine for everything else:

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);

推荐答案

它可能与以下其中一项有关:

It may have to do with one of the following:

  1. 为服务帐户创建范围.确保您正在使用服务帐户访问REST API.
  2. 确保已将漫游器添加到房间或空间中,并且可以访问您要执行的操作.
  3. 确保服务帐户是用于机器人的bot项目的一部分.

这篇关于错误400:invalid_scope"https://www.googleapis.com/auth/chat.bot"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆