Skip to content

Conversation

larsrickert
Copy link

@larsrickert larsrickert commented Aug 19, 2025

closes #25
closes #89

This PR adds support for a generic OpenID connect (OIDC) provider that can be used with any provider that supports the OIDC standard.

It supports the 'code' response type and grant type 'authorization_code'. If a client secret is provided, it will be used to fetch the token. Otherwise the PKCE flow will be used where no client secret is needed.

Since the existing PR #25 has not seen progress in almost two years, this PR is intended to replace #25.

Example usage

# .env
NUXT_OAUTH_OIDC_CLIENT_ID=your-client-id
NUXT_OAUTH_OIDC_OPENID_CONFIG=https://my-provider.com/.well-known/openid-configuration
// server/routes/auth/oidc.ts
export default defineOAuthOidcEventHandler({
  config: {
    scope: ['openid', 'profile', 'email'],
  },
  async onSuccess(event, { user }) {
    await setUserSession(event, {
      user: {
        oidc: user.name,
      },
      loggedInAt: Date.now(),
    })

    return sendRedirect(event, '/')
  },
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for OIDC providers which expose .well-known/openid-configuration
1 participant