UNPKG

@adonisjs/ally

Version:

Social authentication provider for AdonisJS

98 lines (97 loc) 3.27 kB
import { Oauth2Driver } from '../abstract_drivers/oauth2.js'; import type { HttpContext } from '@adonisjs/core/http'; import type { ApiRequestContract, LinkedInOpenidConnectAccessToken, LinkedInOpenidConnectDriverConfig, LinkedInOpenidConnectScopes, RedirectRequestContract } from '@adonisjs/ally/types'; import type { HttpClient } from '@poppinss/oauth-client'; /** * LinkedIn openid connect driver to login user via LinkedIn using openid connect requirements */ export declare class LinkedInOpenidConnectDriver extends Oauth2Driver<LinkedInOpenidConnectAccessToken, LinkedInOpenidConnectScopes> { config: LinkedInOpenidConnectDriverConfig; protected authorizeUrl: string; protected accessTokenUrl: string; protected userInfoUrl: string; /** * The param name for the authorization code */ protected codeParamName: string; /** * The param name for the error */ protected errorParamName: string; /** * Cookie name for storing the "linkedin_openid_connect_oauth_state" */ protected stateCookieName: string; /** * Parameter name to be used for sending and receiving the state * from linkedin */ protected stateParamName: string; /** * Parameter name for defining the scopes */ protected scopeParamName: string; /** * Scopes separator */ protected scopesSeparator: string; constructor(ctx: HttpContext, config: LinkedInOpenidConnectDriverConfig); /** * Configuring the redirect request with defaults */ protected configureRedirectRequest(request: RedirectRequestContract<LinkedInOpenidConnectScopes>): void; /** * Returns the HTTP request with the authorization header set */ protected getAuthenticatedRequest(url: string, token: string): HttpClient; /** * Fetches the user info from the LinkedIn API */ protected getUserInfo(token: string, callback?: (request: ApiRequestContract) => void): Promise<{ id: any; nickName: any; name: any; avatarUrl: any; email: any; emailVerificationState: "verified" | "unverified"; original: any; }>; /** * Find if the current error code is for access denied */ accessDenied(): boolean; /** * Returns details for the authorized user */ user(callback?: (request: ApiRequestContract) => void): Promise<{ token: { token: string; type: "bearer"; expiresIn: number; expiresAt: Exclude<import("@poppinss/oauth-client/types").Oauth2AccessToken["expiresAt"], undefined>; }; id: any; nickName: any; name: any; avatarUrl: any; email: any; emailVerificationState: "verified" | "unverified"; original: any; }>; /** * Finds the user by the access token */ userFromToken(token: string, callback?: (request: ApiRequestContract) => void): Promise<{ token: { token: string; type: "bearer"; }; id: any; nickName: any; name: any; avatarUrl: any; email: any; emailVerificationState: "verified" | "unverified"; original: any; }>; }