简体   繁体   中英

How to get access_token using token endpoint in the node OIDC provider

I tried to get access_token and refresh_token using authorization code flow using node oidc provider. I got auth_code. but I could not get access token and refresh token How to fix this Issue. I referred many documentation but I could not get it.

OIDC Configuration

  const oidc = new Provider('http://localhost:3000', {
  clients: [
    {
      client_id: 'foo',
      client_secret: 'bar',
      redirect_uris: ['https://jwt.io'], // using jwt.io as redirect_uri to show the ID Token contents
      response_types: ['code'],
      grant_types: ['authorization_code'],
      token_endpoint_auth_method: 'none',
    },
  ],
  cookies: {
    keys: 'secretkey'
  },
  pkce: {
    required: true
  },
});

// Heroku has a proxy in front that terminates ssl, you should trust the proxy.
oidc.proxy = true;
app.use(oidc.callback())

I got auth_code also

在此处输入图像描述

在此处输入图像描述

How to get access token and refresh token using node-oidc provider

  1. Your access token request is missing the PKCE code_verifier parameter.
  2. your client's authentication method is set to none , so you're not supposed to pass any authorization header.

you can start your provider process with DEBUG=oidc-provider:* to get more details for these errors.

Invalid Client but you have input "client_id", it mean you are enabling features:

{
    clientCredentials: { 
        enabled: true 
    }
 }

So you must provide client_secret and in oidc-provider source I see it always check code_verifier so you should provide it

验证码

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM