mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-29 02:50:27 +01:00
Working on OAuth
This commit is contained in:
@@ -27,7 +27,7 @@ const allyConfig: AllyConfig = {
|
||||
driver: 'github',
|
||||
clientId: Env.get('GITHUB_CLIENT_ID'),
|
||||
clientSecret: Env.get('GITHUB_CLIENT_SECRET'),
|
||||
callbackUrl: `${Env.get('HOST')}:${Env.get('PORT')}/auth/github`,
|
||||
callbackUrl: `${Env.get('BASE_URL')}:${Env.get('PORT')}/auth/github/callback`,
|
||||
},
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -38,7 +38,7 @@ const allyConfig: AllyConfig = {
|
||||
driver: 'twitter',
|
||||
clientId: Env.get('TWITTER_CLIENT_ID'),
|
||||
clientSecret: Env.get('TWITTER_CLIENT_SECRET'),
|
||||
callbackUrl: `${Env.get('HOST')}:${Env.get('PORT')}/auth/twitter`,
|
||||
callbackUrl: `${Env.get('BASE_URL')}:${Env.get('PORT')}/auth/twitter/callback`,
|
||||
},
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -49,7 +49,7 @@ const allyConfig: AllyConfig = {
|
||||
driver: 'google',
|
||||
clientId: Env.get('GOOGLE_CLIENT_ID'),
|
||||
clientSecret: Env.get('GOOGLE_CLIENT_SECRET'),
|
||||
callbackUrl: `${Env.get('HOST')}:${Env.get('PORT')}/auth/google`,
|
||||
callbackUrl: `${Env.get('BASE_URL')}:${Env.get('PORT')}/auth/google/callback`,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -17,69 +17,8 @@ import { AuthConfig } from '@ioc:Adonis/Addons/Auth'
|
||||
|
|
||||
*/
|
||||
const authConfig: AuthConfig = {
|
||||
guard: 'web',
|
||||
guard: 'api',
|
||||
guards: {
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Web Guard
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Web guard uses classic old school sessions for authenticating users.
|
||||
| If you are building a standard web application, it is recommended to
|
||||
| use web guard with session driver
|
||||
|
|
||||
*/
|
||||
web: {
|
||||
driver: 'session',
|
||||
|
||||
provider: {
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Name of the driver
|
||||
|
|
||||
*/
|
||||
driver: 'lucid',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Identifier key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The identifier key is the unique key on the model. In most cases specifying
|
||||
| the primary key is the right choice.
|
||||
|
|
||||
*/
|
||||
identifierKey: 'id',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Uids
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Uids are used to search a user against one of the mentioned columns. During
|
||||
| login, the auth module will search the user mentioned value against one
|
||||
| of the mentioned columns to find their user record.
|
||||
|
|
||||
*/
|
||||
uids: ['email'],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Model
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The model to use for fetching or finding users. The model is imported
|
||||
| lazily since the config files are read way earlier in the lifecycle
|
||||
| of booting the app and the models may not be in a usable state at
|
||||
| that time.
|
||||
|
|
||||
*/
|
||||
model: () => import('App/Models/User'),
|
||||
},
|
||||
},
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| OAT Guard
|
||||
|
||||
Reference in New Issue
Block a user