From faf74b0dfb3999ea26c61452416e7886274c08e3 Mon Sep 17 00:00:00 2001 From: Arthur DANJOU Date: Fri, 9 Jul 2021 21:44:34 +0200 Subject: [PATCH] Working Signed-off-by: Arthur DANJOU --- config/ally.ts | 67 +++++++++++++++++++++++++++++++++++++++++++++++ contracts/ally.ts | 27 +++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 config/ally.ts create mode 100644 contracts/ally.ts diff --git a/config/ally.ts b/config/ally.ts new file mode 100644 index 0000000..02ebee3 --- /dev/null +++ b/config/ally.ts @@ -0,0 +1,67 @@ +/** + * Config source: https://git.io/JOdi5 + * + * Feel free to let us know via PR, if you find something broken in this config + * file. + */ + +import Env from '@ioc:Adonis/Core/Env' +import {AllyConfig} from '@ioc:Adonis/Addons/Ally' + +/* +|-------------------------------------------------------------------------- +| Ally Config +|-------------------------------------------------------------------------- +| +| The `AllyConfig` relies on the `SocialProviders` interface which is +| defined inside `contracts/ally.ts` file. +| +*/ +const allyConfig: AllyConfig = { + /* + |-------------------------------------------------------------------------- + | Github driver + |-------------------------------------------------------------------------- + */ + github: { + driver: 'github', + clientId: Env.get('GITHUB_CLIENT_ID'), + clientSecret: Env.get('GITHUB_CLIENT_SECRET'), + callbackUrl: 'http://localhost:3333/github/callback', + }, + /* + |-------------------------------------------------------------------------- + | Google driver + |-------------------------------------------------------------------------- + */ + google: { + driver: 'google', + clientId: Env.get('GOOGLE_CLIENT_ID'), + clientSecret: Env.get('GOOGLE_CLIENT_SECRET'), + callbackUrl: 'http://localhost:3333/google/callback', + }, + /* + |-------------------------------------------------------------------------- + | Twitter driver + |-------------------------------------------------------------------------- + */ + twitter: { + driver: 'twitter', + clientId: Env.get('TWITTER_CLIENT_ID'), + clientSecret: Env.get('TWITTER_CLIENT_SECRET'), + callbackUrl: 'http://localhost:3333/twitter/callback', + }, + /* + |-------------------------------------------------------------------------- + | Discord driver + |-------------------------------------------------------------------------- + */ + discord: { + driver: 'discord', + clientId: Env.get('DISCORD_CLIENT_ID'), + clientSecret: Env.get('DISCORD_CLIENT_SECRET'), + callbackUrl: 'http://localhost:3333/discord/callback', + }, +} + +export default allyConfig diff --git a/contracts/ally.ts b/contracts/ally.ts new file mode 100644 index 0000000..e9de077 --- /dev/null +++ b/contracts/ally.ts @@ -0,0 +1,27 @@ +/** + * Contract source: https://git.io/JOdiQ + * + * Feel free to let us know via PR, if you find something broken in this contract + * file. + */ + +declare module '@ioc:Adonis/Addons/Ally' { + interface SocialProviders { + github: { + config: GithubDriverConfig + implementation: GithubDriverContract + } + google: { + config: GoogleDriverConfig + implementation: GoogleDriverContract + } + twitter: { + config: TwitterDriverConfig + implementation: TwitterDriverContract + } + discord: { + config: DiscordDriverConfig + implementation: DiscordDriverContract + } + } +}