mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-22 04:26:23 +08:00
22 lines
487 B
TypeScript
22 lines
487 B
TypeScript
import { OAuthProviderName } from '../config';
|
|
|
|
export interface OAuthAccount {
|
|
id: string;
|
|
email: string;
|
|
avatarUrl?: string;
|
|
}
|
|
|
|
export interface Tokens {
|
|
accessToken: string;
|
|
scope?: string;
|
|
refreshToken?: string;
|
|
expiresAt?: Date;
|
|
}
|
|
|
|
export abstract class OAuthProvider {
|
|
abstract provider: OAuthProviderName;
|
|
abstract getAuthUrl(state: string): string;
|
|
abstract getToken(code: string): Promise<Tokens>;
|
|
abstract getUser(token: string): Promise<OAuthAccount>;
|
|
}
|