OAuth integration for LinkedIn. Refer to LinkedIn OAuth documentation for getting the required credentials. Provider id is linkedin
.
import { linkedIn } from "@lucia-auth/oauth/providers";
import { auth } from "./lucia.js";
const linkedInAuth = linkedIn(auth, config);
linkedIn()
#
const linkedIn: (
auth: Auth,
config: {
clientId: string;
clientSecret: string;
redirectUri: string;
scope?: string[];
}
) => LinkedInProvider;
Parameters#
Scope profile
and openid
are always included.
name | type | description | optional |
---|
auth | Auth | Lucia instance | |
config.clientId | string | LinkedIn OAuth app client id | |
config.clientSecret | string | LinkedIn OAuth app client secret | |
config.redirectUri | string | LinkedIn OAuth app redirect uri | |
config.scope | string[] | an array of scopes | ✓ |
Returns#
Interfaces#
LinkedInAuth
#
See OAuth2ProviderAuth
.
// implements OAuth2ProviderAuth<LinkedInAuth<_Auth>>
interface LinkedInAuth<_Auth extends Auth> {
getAuthorizationUrl: () => Promise<readonly [url: URL, state: string]>;
validateCallback: (code: string) => Promise<LinkedInUserAuth<_Auth>>;
}
Generics#
name | extends | default |
---|
_Auth | Auth | Auth |
LinkedInTokens
#
type LinkedInTokens = {
accessToken: string;
accessTokenExpiresIn: number;
refreshToken: string;
refreshTokenExpiresIn: number;
};
LinkedInUser
#
type LinkedInUser = {
sub: string;
name: string;
email: string;
email_verified: boolean;
given_name: string;
family_name: string;
locale: {
country: string;
language: string;
};
picture: string;
};
LinkedInUserAuth
#
Extends ProviderUserAuth
.
interface LinkedInUserAuth<_Auth extends Auth> extends ProviderUserAuth<_Auth> {
linkedInUser: LinkedInUser;
linkedInTokens: LinkedInTokens;
}
Generics#