Express.js Node.js - OKTA 获取用户和组信息
Express.js Node.js - OKTA getting user and groups info
我正在尝试使用 /users/:id
获取用户信息,并尝试使用 OKTA API 获取用户的组信息 /users/:id/groups
,问题是响应发送为一个字符串格式,我需要在使用前 JSON.parse()
它,这显然是一项额外的工作。有人遇到同样的问题吗?
该解决方案类似于 Noob Coder's comment, I've used the request 发出 http 请求的中间件,它为您提供了一个请求配置选项 {json : true}
,它会自动
sets body but to JSON representation of value and adds Content-type: application/json header. Additionally, parses the response body as JSON.
我正在尝试使用 /users/:id
获取用户信息,并尝试使用 OKTA API 获取用户的组信息 /users/:id/groups
,问题是响应发送为一个字符串格式,我需要在使用前 JSON.parse()
它,这显然是一项额外的工作。有人遇到同样的问题吗?
该解决方案类似于 Noob Coder's comment, I've used the request 发出 http 请求的中间件,它为您提供了一个请求配置选项 {json : true}
,它会自动
sets body but to JSON representation of value and adds Content-type: application/json header. Additionally, parses the response body as JSON.