nuxt-openid-connect icon indicating copy to clipboard operation
nuxt-openid-connect copied to clipboard

Stuck in login loop

Open peirix opened this issue 7 months ago • 3 comments

I've got this setup:

openidConnect: {
    addPlugin: true,
    op: {
        issuer: process.env.NUXT_OPENID_CONNECT_OP_ISSUER || '',
        clientId: process.env.NUXT_OPENID_CONNECT_OP_CLIENT_ID || '',
        clientSecret: process.env.NUXT_OPENID_CONNECT_OP_CLIENT_SECRET || '',
        callbackUrl: process.env.NUXT_OPENID_CONNECT_OP_CALLBACK_URL || '', // http://localhost:3000/mine-rom
        scope: ['openid userid-feide']
    },
    config: {
        debug: true, // optional, default is false
        response_type: 'code',
        secret: 'oidc._sessionid',
        cookie: { loginName: '' },
        cookiePrefix: 'oidc._',
        cookieEncrypt: true,
        cookieEncryptKey: 'bfnuxt9c2470cb477d907b1e0917oidc', // 32
        cookieEncryptIV: 'ab83667c72eec9e4', // 16
        cookieEncryptALGO: 'aes-256-cbc',
        cookieMaxAge: 24 * 60 * 60, //  default one day
        cookieFlags: {
            // default is empty
            access_token: {
                httpOnly: true,
                secure: false
            }
        }
    }
}

The vue-page mine-rom is set up to use the same auth middleware in your playground folder.

When I go to login, I'm sent back to /mine-rom with params: ?redirect=/mine-rom&code=fae65820-9bb2-48be-b02d-0ce4a1749022 And then it triggers the auth middleware and for some reason it detects I'm not logged in, so it sends me back to the login with this redirect url: http://localhost:3000/mine-rom?redirect=/mine-rom?redirect=/mine-rom&code=fae65820-9bb2-48be-b02d-0ce4a1749022 and if I login from that it just keeps adding redirect params to the url.

In my localstorage I see a key oidc._user which is just set to {}, and in my cookies I see the oidc._sessionid has a hashed value.

peirix avatar Jan 03 '24 12:01 peirix