OAuth 2.0 integration for Line (v2.1). Provider id is line
.
import { line } from "@lucia-auth/oauth/providers";
import { auth } from "./lucia.js";
const lineAuth = line(auth, configs);
line()
#
Scopes oidc
are profile
are always included.
const line: (
auth: Auth,
configs: {
clientId: string;
clientSecret: string;
redirectUri: string;
scope?: string[];
}
) => LineProvider;
Parameters#
name | type | description | optional |
---|
auth | Auth | Lucia instance | |
config.clientId | string | Line OAuth app client id | |
config.clientSecret | string | Line OAuth app client secret | |
config.redirectUri | string | an authorized redirect URI | |
config.scope | string[] | an array of scopes | ✓ |
Returns#
Interfaces#
LineAuth
#
See OAuth2ProviderAuth
.
// implements OAuth2ProviderAuth<LineAuth<_Auth>>
interface LineAuth<_Auth extends Auth> {
getAuthorizationUrl: () => Promise<readonly [url: URL, state: string]>;
validateCallback: (code: string) => Promise<LineUserAuth<_Auth>>;
}
Generics#
name | extends | default |
---|
_Auth | Auth | Auth |
LineTokens
#
type LineTokens = {
accessToken: string;
accessTokenExpiresIn: number;
refreshToken: string;
idToken: string;
};
LineUser
#
Add email
scope to get LineUser.email
.
type LineUser = {
userId: string;
displayName: string;
pictureUrl: string;
statusMessage: string;
email: string | null;
};
LineUserAuth
#
Extends ProviderUserAuth
.
interface LineUserAuth<_Auth extends Auth> extends ProviderUserAuth<_Auth> {
lineUser: LineUser;
lineTokens: LineTokens;
}
Generics#