svoauth
Version:
`svoauth` is a minimal and flexible OAuth 2.0 wrapper designed for SvelteKit projects. It uses a config-driven approach so you can easily plug in providers like GitHub, Google, and more.
32 lines (30 loc) • 714 B
TypeScript
//#region \0dts:/home/runner/work/svoauth/svoauth/src/types/index.d.ts
type Scopes = {
values: string[]
delimiter?: " " | "," | ":"
};
interface OAuthClient {
clientId: string;
clientSecret: string;
authorizeUrl: string;
tokenUrl: string;
revokeTokenUrl?: string;
refreshTokenUrl?: string;
redirectUri: string;
pkce?: boolean;
basicAuth?: boolean;
scopes: Scopes;
params?: Record<string, string>[];
}
interface Tokens {
hasAccessToken(): boolean;
hasRefreshToken(): boolean;
accessToken(): string;
refreshToken(): string;
expiresAt(): Date | undefined;
refreshToken(): string;
idToken(): string;
}
type OAuthConfigs = Record<string, OAuthClient>;
//#endregion
export { OAuthConfigs, Tokens };