OAuth integration for Lichess. Provider id is lichess
.
import { lichess } from "@lucia-auth/oauth/providers";
import { auth } from "./lucia.js";
const lichessAuth = lichess(auth, config);
lichess()
#
const lichess: (
auth: Auth,
config: {
clientId: string;
redirectUri: string;
scope?: string[];
}
) => LichessProvider;
Parameter#
name | type | description | optional |
---|
auth | Auth | Lucia instance | |
config.clientId | string | client id - choose any unique client id | |
config.redirectUri | string | redirect URI | |
config.scope | string[] | an array of scopes | ✓ |
Returns#
Interfaces#
LichessAuth
#
See OAuth2ProviderAuthWithPKCE
.
// implements OAuth2ProviderAuthWithPKCE<LichessAuth<_Auth>>
interface LichessAuth<_Auth extends Auth> {
getAuthorizationUrl: () => Promise<
readonly [url: URL, codeVerifier: string, state: string]
>;
validateCallback: (
code: string,
codeVerifier: string
) => Promise<LichessUserAuth<_Auth>>;
}
Generics#
name | extends | default |
---|
_Auth | Auth | Auth |
LichessTokens
#
type LichessTokens = {
accessToken: string;
accessTokenExpiresIn: number;
};
LichessUser
#
type LichessUser = {
id: string;
username: string;
};
LichessUserAuth
#
Extends ProviderUserAuth
.
interface LichessUserAuth<_Auth extends Auth> extends ProviderUserAuth<_Auth> {
lichessUser: LichessUser;
lichessTokens: LichessTokens;
}
Generics#