Open mauromn1992 opened 2 years ago
May I see your config/auth.ts
? I think you forgot to remove the import statement on the config. Because it's not recommended to use Prisma and Lucid at the same time.
/**
import { AuthConfig } from '@ioc:Adonis/Addons/Auth'
/* | -------------------------------------------------------------------------- | Authentication Mapping |
---|---|---|
List of available authentication mapping. You must first define them | ||
inside the contracts/auth.ts file before mentioning them here. |
||
/ const authConfig: AuthConfig = { guard: 'api', guards: { / | -------------------------------------------------------------------------- | OAT Guard |
---|---|---|
OAT (Opaque access tokens) guard uses database backed tokens to authenticate | ||
HTTP request. This guard DOES NOT rely on sessions or cookies and uses | ||
Authorization header value for authentication. | ||
Use this guard to authenticate mobile apps or web clients that cannot rely | ||
on cookies/sessions. | ||
*/
api: {
driver: 'oat',
/*
|--------------------------------------------------------------------------
| Tokens provider
|--------------------------------------------------------------------------
|
| Uses SQL database for managing tokens. Use the "database" driver, when
| tokens are the secondary mode of authentication.
| For example: The Github personal tokens
|
| The foreignKey column is used to make the relationship between the user
| and the token. You are free to use any column name here.
|
*/
tokenProvider: {
type: 'api',
driver: 'database',
table: 'api_tokens',
foreignKey: 'user_id',
},
provider: {
driver: 'prisma',
identifierKey: 'id',
uids: ['email'],
model: 'user',
},
},
}, }
export default authConfig
Route Login:
message:
E_IOC_LOOKUP_FAILED: Cannot resolve \"Adonis/Lucid/Database\" namespace from the IoC Container"
stack:
IocLookupException: E_IOC_LOOKUP_FAILED: Cannot resolve \"Adonis/Lucid/Database\" namespace from the IoC Container\n at Function.lookupFailed (/com.docker.devenvironments.code/backend/node_modules/@adonisjs/fold/build/src/Exceptions/IocLookupException.js:18:16)\n at Ioc.lookupOrFail (/com.docker.devenvironments.code/backend/node_modules/@adonisjs/fold/build/src/Ioc/index.js:254:59)\n at Ioc.use (/com.docker.devenvironments.code/backend/node_modules/@adonisjs/fold/build/src/Ioc/index.js:308:33)\n at AuthManager.makeTokenDatabaseProvider (/com.docker.devenvironments.code/backend/node_modules/@adonisjs/auth/build/src/AuthManager/index.js:79:53)\n at AuthManager.makeTokenProviderInstance (/com.docker.devenvironments.code/backend/node_modules/@adonisjs/auth/build/src/AuthManager/index.js:193:29)\n at AuthManager.makeOatGuard (/com.docker.devenvironments.code/backend/node_modules/@adonisjs/auth/build/src/AuthManager/index.js:104:36)\n at AuthManager.makeGuardInstance (/com.docker.devenvironments.code/backend/node_modules/@adonisjs/auth/build/src/AuthManager/index.js:212:29)\n at AuthManager.makeMapping (/com.docker.devenvironments.code/backend/node_modules/@adonisjs/auth/build/src/AuthManager/index.js:228:21)\n at Auth.use (/com.docker.devenvironments.code/backend/node_modules/@adonisjs/auth/build/src/Auth/index.js:37:58)\n at /com.docker.devenvironments.code/backend/start/routes.ts:37:34