adonisjs/auth

Executing `node ace configure @adonisjs/auth --guard=access_tokens` does not pass `tokens: 'authTokens'` to tokensUserProvider

kaypee90 opened this issue · 1 comments

Package version

@adonisjs/auth@9.1.1

Describe the bug

As stated in the authentication documentation for Adonis version 6, this is the required structure for authConfig in the config/auth.ts file

const authConfig = defineConfig({
  default: 'api',
  guards: {
    api: tokensGuard({
      provider: tokensUserProvider({
        tokens: 'authTokens',
        model: () => import('#models/user'),
      })
    }),
  },
})

But executing the command configure command node ace configure @adonisjs/auth --guard=access_tokens the generated config/auth.ts file excludes tokens: 'authTokens', you rather get

const authConfig = defineConfig({
  default: 'api',
  guards: {
    api: tokensGuard({
      provider: tokensUserProvider({
        model: () => import('#models/user')
      }),
    }),
  },
})

This issue is related to adonisjs/core#4372

Reproduction repo

No response

Hello, this issue was fixed in this commit. adonisjs/presets@b379c6b

Maybe when you configured the guard, you were using an older version of @adonisjs/auth package.


Also, I have noticed that our stubs use the term accessTokens and docs use authTokens. I have update the docs to match the default stubs naming convention here. adonisjs/v6-docs@b7e424a