Jwt 如何获得正确的Auth0承载令牌?

Jwt 如何获得正确的Auth0承载令牌?,jwt,koa,auth0,Jwt,Koa,Auth0,我想为node.js应用程序获取Auth0承载令牌 我通过这样做获得了持票人代币: curlhttps://myproject.eu.auth0.com/oauth/token --数据“client\u id=id&client\u secret=secret&type=web\u server&grant\u type=client\u凭证” 这让我想起: { "access_token": *BEARER TOKEN*, "token_type": "Bearer" } 但是,如

我想为node.js应用程序获取Auth0承载令牌

我通过这样做获得了持票人代币:

curlhttps://myproject.eu.auth0.com/oauth/token --数据“client\u id=id&client\u secret=secret&type=web\u server&grant\u type=client\u凭证”

这让我想起:

{
  "access_token": *BEARER TOKEN*,
  "token_type": "Bearer"
}
但是,如果我在Auth头中使用该标记和postman,它会告诉我:
无效令牌
。那么,我如何获得正确的持票人代币呢

我的服务器如下所示:

const koa = require('koa');
const route = require('koa-route');
const jwt = require('koa-jwt');
const testRoute = require('./testRoute');

const app = koa();
//Copy pasted those values from my auth0 dashboard
const authentication = jwt({
  secret: new Buffer(*CLIENT_SECRET*, 'base64'),
  audience: *YOUR_CLIENT_ID*
});
app.use(authentication);
app.use(route.get('/test', testRoute));
app.listen(3000);

我按照这个指南进行了设置:.

访问令牌是一个不透明的令牌,而不是应用程序所期望的JWT。如果您在调用
/oauth/token
时使用
scope=openid
,您也会得到一个
id\u令牌,这是您的API应该接受的JWT

您可以在此处阅读有关Auth0上下文中
范围
参数如何工作的更多信息: