UNPKG

@adonisjs/ally

Version:

Social authentication provider for AdonisJS

37 lines (36 loc) 2.42 kB
import type { HttpContext } from '@adonisjs/core/http'; import type { ConfigProvider } from '@adonisjs/core/types'; import type { GoogleDriver } from './drivers/google.js'; import type { GithubDriver } from './drivers/github.js'; import type { SpotifyDriver } from './drivers/spotify.js'; import type { TwitterDriver } from './drivers/twitter.js'; import type { DiscordDriver } from './drivers/discord.js'; import type { FacebookDriver } from './drivers/facebook.js'; import type { LinkedInDriver } from './drivers/linked_in.js'; import type { LinkedInOpenidConnectDriver } from './drivers/linked_in_openid_connect.js'; import type { GoogleDriverConfig, GithubDriverConfig, SpotifyDriverConfig, DiscordDriverConfig, TwitterDriverConfig, LinkedInDriverConfig, LinkedInOpenidConnectDriverConfig, FacebookDriverConfig, AllyManagerDriverFactory } from './types.js'; /** * Shape of config after it has been resolved from * the config provider */ type ResolvedConfig<KnownSocialProviders extends Record<string, AllyManagerDriverFactory | ConfigProvider<AllyManagerDriverFactory>>> = { [K in keyof KnownSocialProviders]: KnownSocialProviders[K] extends ConfigProvider<infer A> ? A : KnownSocialProviders[K]; }; /** * Define config for the ally */ export declare function defineConfig<KnownSocialProviders extends Record<string, AllyManagerDriverFactory | ConfigProvider<AllyManagerDriverFactory>>>(config: KnownSocialProviders): ConfigProvider<ResolvedConfig<KnownSocialProviders>>; /** * Helpers to configure social auth services */ export declare const services: { discord: (config: DiscordDriverConfig) => ConfigProvider<(ctx: HttpContext) => DiscordDriver>; facebook: (config: FacebookDriverConfig) => ConfigProvider<(ctx: HttpContext) => FacebookDriver>; github: (config: GithubDriverConfig) => ConfigProvider<(ctx: HttpContext) => GithubDriver>; google: (config: GoogleDriverConfig) => ConfigProvider<(ctx: HttpContext) => GoogleDriver>; linkedin: (config: LinkedInDriverConfig) => ConfigProvider<(ctx: HttpContext) => LinkedInDriver>; linkedinOpenidConnect: (config: LinkedInOpenidConnectDriverConfig) => ConfigProvider<(ctx: HttpContext) => LinkedInOpenidConnectDriver>; spotify: (config: SpotifyDriverConfig) => ConfigProvider<(ctx: HttpContext) => SpotifyDriver>; twitter: (config: TwitterDriverConfig) => ConfigProvider<(ctx: HttpContext) => TwitterDriver>; }; export {};