【发布时间】:2021-02-23 18:32:03
【问题描述】:
所以我正在尝试获取访问令牌以删除用户。
var options = {
method: 'POST',
url: 'https://dev-owihjaep.auth0.com/oauth/token',
headers: {'content-type': 'application/json'},
data: {
grant_type: 'client_credentials',
client_id: 'RGPTciPqTAlJSDoO3zkL4GT1HV3fsptj',
client_secret: process.env.AUTH0_CLIENT_SECRET,
audience: 'https://dev-owihjaep.auth0.com/api/v2/'
}
};
let accessTokenResponse = await axios.request(options)
它在 localhost 中工作,但由于某种原因,我部署的应用程序得到了 status: 401, statusText: 'Unauthorized' 和 data: { error: 'access_denied', error_description: 'Unauthorized' }。我为我的客户创建了客户端授权,确保在 Auth0 管理 API 设置中的机器到机器应用程序中为我的应用程序切换了授权,并确保为我的应用程序检查了客户端凭据的授权类型。我该如何解决这个错误?
【问题讨论】: