itpropro / nuxt-oidc-auth

OIDC (OpenID connect) focused auth module for Nuxt
https://nuxtoidc.cloud
MIT License
82 stars 21 forks source link

Add ability to expose specific claims #36

Closed DerSimeon closed 1 month ago

DerSimeon commented 5 months ago

We use the OID to Identify the user. Using a server plugin we tried adding the OID from the IDToken to the claims.

However it appears that the claims are not exposed to the session object when using getUserSession on the server-side. We need a way to identify the user and OID is our current way to go.

Adding a way to expose claims to the serverside session would be ideal.

itpropro commented 2 months ago

You can access the claims by using the session on the server side:

import { requireUserSession } from "nuxt-oidc-auth/runtime/server/utils/session.mjs"

export default eventHandler(async (event) => {
  const session = await requireUserSession(event)
}