在将 JWKS 与 Auth0 一起使用时,如果我使用的是本地主机,受众和发行者是什么?

In using JWKS with Auth0 what is the audience and issuer if I'm using localhost?

我已经在我的 Node Koa 应用程序中实现了 JWT:

import Router from 'koa-router-middleware';
import { ApplicationState, ApplicationContext } from './types';
import configure from './configure';
import swagger from './swagger';
import healthcheck from './healthcheck';
import helloworld from './helloworld';
const jwt = require('jsonwebtoken');
// import * as jwt from 'jsonwebtoken'; << TODO
import * as koajwt from 'koa-jwt';

export default new Router<ApplicationState, ApplicationContext>()
  .use(configure)
  .use('/openapi.json', swagger)
  .use('/', helloworld)
  .use('/healthcheck', healthcheck)
  .use('/token', (ctx) => {
    const token = jwt.sign({ data: 'tokenData' }, 'secret');
    ctx.response.body = token;
  })
  // Secure routes
  .use(koajwt({ secret: 'secret' }))
  .use('/secure', helloworld)
  .middleware();

这有效 ^ 现在我正试图让它与 Auth0 一起工作,所以我研究了 JWKS,这就是我所拥有的:

import Router from 'koa-router-middleware';
import { ApplicationState, ApplicationContext } from './types';
import configure from './configure';
import swagger from './swagger';
import healthcheck from './healthcheck';
import helloworld from './helloworld';
// const jsonwebtoken = require('jsonwebtoken');
// import * as jwt from 'jsonwebtoken'; << TODO
import * as jwt from 'koa-jwt';
const jwksRsa = require('jwks-rsa');

const jwksHost = 'omitted'
const audience = 'http://localhost:8080'
const issuer = '??'

export default new Router<ApplicationState, ApplicationContext>()
  .use(configure)
  .use('/openapi.json', swagger)
  .use('/', helloworld)
  .use('/healthcheck', healthcheck)
  .use(jwt({
    secret: jwksRsa.koaJwtSecret({
      cache: true,
      rateLimit: true,
      jwksRequestsPerMinute: 2,
      jwksUri: `${jwksHost}/.well-known/jwks.json`
    }),
    audience,
    issuer,
    algorithms: [ 'RS256' ]
  }))

  // Secure routes. Anything below this comment needs a jwt token
  .use('/secure', helloworld)
  .middleware();

第一个问题:我可以从本地主机执行此操作还是必须上传我的代码才能运行?

第二个问题:我正在使用创建帐户时 Auth0 分配给我的 JWKS 端点,我是否可以正确地假设每个帐户只有一个 JWKS 端点,即使该帐户有多个 API? (在 this website 上说每个租户都有一个,我认为这意味着帐户,但我想确认一下)

第三个问题:抛开观众和发布者,这段代码看起来是对的还是漏了什么?

的答案

似乎应该是:

audience: 'http://localhost:3000', // With your port
issuer: `https://${process.env.AUTH0_DOMAIN}/` // Your Auth0 domain