google-apis-explorer - Google Directory API user list request failing with 400 Invalid Input
问题描述
I'm trying to get a successful response when executing the request from https://developers.google.com/admin-sdk/directory/v1/reference/users/list?apix_params=%7B%22customer%22%3A%22my_customer%22%7D. I'm getting a 400 Invalid Input
response.
With the client library(https://www.npmjs.com/package/googleapis, v47), when calling:
google.admin('directory_v1')
.users.list({
auth: oAuth2Client,
customer: 'my_customer',
orderBy: 'email',
maxResults: 500,
pageToken: null
}).then(...);
, I'm receiving a Request
object in the success handler, instead of a valid response(response which should have had the shape described at the bottom of https://developers.google.com/admin-sdk/directory/v1/reference/users/list).
What am I doing wrong?
解决方案
原来问题出在身份验证过程中,使用google-auth-library
. 我已经采取了这样的措施:
const {google} = require('googleapis');
const oAuthClient = await google.auth.getClient({keyFile: ..., scopes: [...]});
oAuthClient.credentials = await new google.auth.JWT(...).authorizeAsync();
const {data} = await google
.admin({version: 'directory_v1', auth: oAuthClient})
.users
.list({
customer: 'my_customer'
});
推荐阅读
- android - 更改默认拨号器的请求未在某些设备上显示系统对话框
- r - 在 R 的 data.table 中,如何在数据表中创建一个新列,其值匹配并对应于列元素和另一个表?
- python - Python如何在循环中解析json usng标签
- steam - 如何检查 Steam 帐户是否是 Steam 上现有已开发游戏的开发者帐户?
- python - 使用 pyqt5 和 malplotlib 进行图形滚动
- c - 测量 CUDA 内核时时序不同
- delphi - 如何将 TPath 数据保存为 `.jpg` 图像
- php - Magento2。如何创建不会绑定到数据库的列
- jsf - 在第二次加载/重新加载视图时在父组件上使用绑定属性时所有子组件的 ID 重复
- r - R - 格式化 - 试图隐藏第 0 列