Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong type in ZITADEL provider #9

Open
buehler opened this issue Aug 29, 2023 · 0 comments
Open

Wrong type in ZITADEL provider #9

buehler opened this issue Aug 29, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@buehler
Copy link

buehler commented Aug 29, 2023

The type in the ZITADEL Provider (options) is wrong. The thing about the underlying openidconfiguration type (https://github.com/nextauthjs/next-auth/blob/main/packages/next-auth/src/providers/zitadel.ts#L28) is that you cannot use PKCE without using "any" to type your options.

Your own recommended way to use ZITADEL is "PKCE", which needs to be configured as such (example):

export const authOptions: NextAuthOptions = {
  providers: [
    {
      id: 'zitadel',
      name: 'zitadel',
      type: 'oauth',
      version: '2',
      wellKnown: process.env.ZITADEL_ISSUER,
      authorization: {
        params: {
          scope: 'openid email profile',
        },
      },
      idToken: true,
      checks: ['pkce', 'state'], <<< THIS allows PKCE
      client: {
        token_endpoint_auth_method: 'none', <<< THIS allows PKCE
      },
      // profile method and other stuff
      clientId: process.env.ZITADEL_CLIENT_ID,
      // the type REQUIRES "clientSecret". but while using PKCE, there is none.
    },
  ],
  // other config
  secret: process.env.NEXTAUTH_SECRET,
};

export default NextAuth(authOptions);

I'd encourage you to update the ZITADEL provider in NEXT since you promote PKCE as the standard to use.

@hifabienne hifabienne added the bug Something isn't working label Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 🐛 Bugs/Small Issues
Development

No branches or pull requests

2 participants