快递网关 jwt 发行不工作

express gateway jwt issuing not working

我是 EG 的新手。我遵循了有关发布 jwt 令牌而不是不透明但仍收到不透明访问令牌的文档。不确定我缺少更改的内容。

这是我的 system.config 文件

db:
  redis:
  host: localhost
  port: 6379
  namespace: EG

crypto:
  cipherKey: sensitiveKey
  algorithm: aes256
  saltRounds: 10
session:
  secret: keyboard cat
  resave: false
  saveUninitialized: false
accessTokens:
  timeToExpiry: 7200000
  tokenType: 'jwt'
  issuer: 'express-gateway'
  audience: 'something'
  subject: 'test'
  secretOrPrivateKey: 'ssssst'
refreshTokens:
  timeToExpiry: 7200000
authorizationCodes:
  timeToExpiry: 300000

已经使用自己的凭据(oauth2、basic-auth、jwt)添加了用户和应用程序,而没有更改模型上的任何内容。

这是我的 gateway.config 文件

http:
  port: 8080
admin:
  port: 9876
  hostname: localhost
apiEndpoints:
  api:
    host: localhost
    paths: '/api/*'
serviceEndpoints:
  httpbin:
    url: 'https://httpbin.org'
policies:
  - jwt
  - oauth2
  - proxy
  - rate-limit
pipelines:
  default:
    apiEndpoints:
      - api
    policies:
      - oauth2:
          action:
            jwt:
              issuer: express-gateway
              audience: something
              subject: test
              secretOrPublicKey: ssssst
              checkCredentialExistence: false
      - proxy:
          - action:
              serviceEndpoint: httpbin
              changeOrigin: true

登录请求是这样的,secret是应用的jwt凭证生成的keySecret

http://localhost:8080/oauth2/authorize?response_type=token&client_id=ae921ba9-7b4b-4c53-aaba-354bd6398e52&redirect_uri=http://localhost:3002/explorer&client_secret=0qOpBZkwO2ayQ8dO18yRuh

令牌响应如下所示。

14070f7c4ffc49efb1fc1709cc4a7267|90c6efd2cf8342859756d8e3705417a3

感谢任何能帮助我的人。

配置看起来正确。我也亲自尝试了你提供的配置,我得到了 JWT

也许您可以尝试在 Glitch.me 上设置一个测试项目,这样在本地复制会更容易。