Skip to content

Custom scheme path throws TS type error #124

Open
@Serveix

Description

Environment

  • Operating System: Darwin
  • Node Version: v22.11.0
  • Nuxt Version: 3.15.0
  • CLI Version: 3.17.2
  • Nitro Version: 2.10.4
  • Package Manager: npm@10.9.0
  • Builder: -
  • User Config: default
  • Runtime Modules: @nuxt-alt/auth@3.1.7
  • Build Modules: -

Nuxt Config

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  compatibilityDate: '2024-11-01',
  devtools: { enabled: true },
  modules: [
    '@nuxt-alt/auth'
  ],
  auth: {
    globalMiddleware: true,
    strategies: {
      custom: {
        scheme: '~/schemes/google_custom', // type error
        clientId: '...',
        codeChallengeMethod: '',
        responseType: 'code',
        accessType: 'online',
        endpoints: {
          token: 'http://example.com:8000/auth/google/callback',
          userInfo: 'http://example.com:8000/api/user'
        },
        token: {
          property: 'access_token',
          maxAge: 30 * 60
        },
        autoLogout: false
      }
    }
  }
})

Reproduction

https://stackblitz.com/edit/nuxt-starter-5kxbh8pz?file=nuxt.config.ts

Describe the bug

In the nuxt.config.ts strategy properties, when adding a custom scheme path according to the documentation:
https://nuxt-alt-auth.vercel.app/guide/schemes

The scheme property throws a type error

  auth: {
    strategies: {
      google: {
        scheme: '~/schemes/google_custom', // TS type error
        clientId: '...',
        codeChallengeMethod: '',
        responseType: 'code',

I believe this is because the type definition only allows predefined values:

export type SchemeNames<N = ''> = 'local' | 'cookie' | 'laravelJWT' | 'openIDConnect' | 'refresh' | 'oauth2' | 'auth0' | N

I will be submitting a PR to solve this.

Additional context

No response

Logs

No response

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions