如何使用 OIDC 提供程序在 /token 端点获取访问令牌和刷新令牌
How to get access token and refresh token in the /token endpoint using OIDC provider
我试图在 /token 端点获取访问令牌和刷新令牌。我获得了授权码,我将传递令牌端点,但它抛出 grant request is invalid 错误。如何解决这个问题
配置
const oidc = new Provider('http://localhost:3000', {
clients: [
{
// client_id: 'foo',
// redirect_uris: ['https://jwt.io'], // using jwt.io as redirect_uri to show the ID Token contents
// response_types: ['id_token'],
// grant_types: ['implicit'],
// token_endpoint_auth_method: 'none',
client_id: 'secret',
redirect_uris: ['http://localhost:3000/api/v1'], // using jwt.io as redirect_uri to show the ID Token contents
response_types: ['code'],
grant_types: ['authorization_code', 'refresh_token'],
token_endpoint_auth_method: 'none',
},
],
cookies: {
keys: 'secret key',
},
features: {
clientCredentials: {enable:true},
introspection: {enable:true}
},
pkce: {
required: true
},
token_endpoint_auth_method: "none",
});
令牌API
如何解决这个问题。我尝试了很多方法并参考了很多文档,但我无法得到解决方案
您的访问令牌请求缺少 PKCE code_verifier 参数。
您可以使用 DEBUG=oidc-provider:*
启动您的提供商流程,以获取有关这些错误的更多详细信息。
我试图在 /token 端点获取访问令牌和刷新令牌。我获得了授权码,我将传递令牌端点,但它抛出 grant request is invalid 错误。如何解决这个问题
配置
const oidc = new Provider('http://localhost:3000', {
clients: [
{
// client_id: 'foo',
// redirect_uris: ['https://jwt.io'], // using jwt.io as redirect_uri to show the ID Token contents
// response_types: ['id_token'],
// grant_types: ['implicit'],
// token_endpoint_auth_method: 'none',
client_id: 'secret',
redirect_uris: ['http://localhost:3000/api/v1'], // using jwt.io as redirect_uri to show the ID Token contents
response_types: ['code'],
grant_types: ['authorization_code', 'refresh_token'],
token_endpoint_auth_method: 'none',
},
],
cookies: {
keys: 'secret key',
},
features: {
clientCredentials: {enable:true},
introspection: {enable:true}
},
pkce: {
required: true
},
token_endpoint_auth_method: "none",
});
令牌API
如何解决这个问题。我尝试了很多方法并参考了很多文档,但我无法得到解决方案
您的访问令牌请求缺少 PKCE code_verifier 参数。
您可以使用 DEBUG=oidc-provider:*
启动您的提供商流程,以获取有关这些错误的更多详细信息。