简体   繁体   中英

In node-oidc-provider no JWT is issued

I've configured oidc-provider in nodejs as follows:

const configuration: Configuration = {
    interactions: {
        url(ctx, interaction) {
            return `/interaction/${interaction.uid}`;
        },
    },
    clients: [{
        client_id: 'foo',
        client_secret: 'bar',
        redirect_uris: ['http://localhost:3000'],
        application_type: 'web',
        response_types: ['code'],
        grant_types: ['authorization_code', 'refresh_token'],
        token_endpoint_auth_method: 'client_secret_jwt',
    }],
    claims: {
        address: ['address'],
        email: ['email', 'email_verified'],
        profile: ['firstname', 'lastname']3
    },
    async findAccount(ctx, id, token) {
        return {
            accountId: id,
            async claims() { return { sub: id }; },
        };
    },
    features: {
        devInteractions: { enabled: false },
        resourceIndicators: {
            enabled: true,
            getResourceServerInfo: (c, r, client) => ({
                scope: client.scope!,
                audience: 'solid',
                accessTokenTTL: 2 * 60 * 60, // 2 hours
                accessTokenFormat: 'jwt',
                jwt: {
                    sign: { alg: 'ES256' },
                },
            }),
            defaultResource: (ctx) => {
                return ctx.URL.origin
            }
        },
    },
}

On the web client however, I don't get a JWT token. Instead, the following object is returned by the server:

{
  "id": "0a14e47b326320709ccb3318b521d625",
  "created": 1663510239,
  "request_type": "si:r",
  "code_verifier": "bfea58a5db0e4167b52c6a9ab111d7ad789b9a79d627484097587026058df3d2c716e136fc5e4004909343072260f522",
  "authority": "http://localhost:14000",
  "client_id": "foo",
  "redirect_uri": "http://localhost:3000",
  "scope": "openid",
  "extraTokenParams": {},
  "response_mode": "query"
}

Is my configuration incorrect? I read that in older versions of oidc-provider, an access_token parameter was enough in order to produce JWT tokens. I'm using version 7.12.0. My understanding is that in this version it's supposed to be necessary to configure "jwt" in the getResourceServerInfo property - which I did.

Does anyone know why no JWT is generated?

Solved by migrating to the fosite Golang library.

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