@coji/remix-auth-google
Version:
<!-- Description -->
65 lines (64 loc) • 1.95 kB
TypeScript
import { OAuth2Strategy } from 'remix-auth-oauth2';
import type { OAuth2Tokens } from 'arctic';
/**
* @see https://developers.google.com/identity/protocols/oauth2/scopes
*/
export type GoogleScope = string;
export type GoogleStrategyOptions = {
clientId: string;
clientSecret: string;
redirectURI: string;
/**
* @default "openid profile email"
*/
scopes?: GoogleScope[];
accessType?: 'online' | 'offline';
includeGrantedScopes?: boolean;
prompt?: 'none' | 'consent' | 'select_account';
hd?: string;
loginHint?: string;
};
export type GoogleProfile = {
id: string;
displayName: string;
name: {
familyName: string;
givenName: string;
};
emails: [{
value: string;
}];
photos: [{
value: string;
}];
_json: {
sub: string;
name: string;
given_name: string;
family_name: string;
picture: string;
locale: string;
email: string;
email_verified: boolean;
hd: string;
};
};
export type GoogleExtraParams = {
expires_in: 3920;
token_type: 'Bearer';
scope: string;
id_token: string;
} & Record<string, string | number>;
export declare const GoogleStrategyDefaultScopes: string[];
export declare const GoogleStrategyDefaultName = "google";
export declare class GoogleStrategy<User> extends OAuth2Strategy<User> {
name: string;
private readonly accessType;
private readonly prompt?;
private readonly includeGrantedScopes;
private readonly hd?;
private readonly loginHint?;
constructor({ clientId, clientSecret, redirectURI, scopes, accessType, includeGrantedScopes, prompt, hd, loginHint, }: GoogleStrategyOptions, verify: OAuth2Strategy<User>['verify']);
protected authorizationParams(params: URLSearchParams, request?: Request): URLSearchParams;
static userProfile(tokens: OAuth2Tokens): Promise<GoogleProfile>;
}