From 93af8f2a0a6c861f119855f4989d84a75c17e3b7 Mon Sep 17 00:00:00 2001 From: RaviAnand Mohabir Date: Sun, 23 May 2021 22:06:47 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=B7=EF=B8=8F=20Remove=20comments=20/?= =?UTF-8?q?=20use=20`OAuth2ProviderConfig`=20for=20`GoogleOAuth2Provider`?= =?UTF-8?q?=20types?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/providers/google.ts | 41 +++-------------------------------------- 1 file changed, 3 insertions(+), 38 deletions(-) diff --git a/src/providers/google.ts b/src/providers/google.ts index e84dc70..67deced 100644 --- a/src/providers/google.ts +++ b/src/providers/google.ts @@ -1,8 +1,6 @@ import { OAuth2Provider, OAuth2ProviderConfig } from "./oauth2"; -interface GoogleOAuth2ProviderConfig extends OAuth2ProviderConfig {} - -const defaultConfig: Partial = { +const defaultConfig: Partial = { id: "google", scope: ["openid", "profile", "email"], accessTokenUrl: "https://accounts.google.com/o/oauth2/token", @@ -10,44 +8,11 @@ const defaultConfig: Partial = { profileUrl: "https://openidconnect.googleapis.com/v1/userinfo", }; -export class GoogleOAuth2Provider extends OAuth2Provider { - constructor(config: GoogleOAuth2ProviderConfig) { +export class GoogleOAuth2Provider extends OAuth2Provider { + constructor(config: OAuth2ProviderConfig) { super({ ...defaultConfig, ...config, }); } - - /* getAuthorizationUrl({ host }: ServerRequest, auth: Auth, state: string) { - const data = { - response_type: "code", - client_id: this.config.clientId, - scope: Array.isArray(this.config.scope) ? this.config.scope.join(" ") : this.config.scope, - redirect_uri: this.getCallbackUri(auth, host), - state, - }; - - const url = `${this.config.authorizationUrl!}?${new URLSearchParams(data)}`; - return url; - } */ - - /* async getTokens(code: string, redirectUri: string) { - const data = { - code, - client_id: this.config.clientId, - client_secret: this.config.clientSecret, - redirect_uri: redirectUri, - grant_type: "authorization_code", - }; - - const res = await fetch(this.config.accessTokenUrl!, { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify(data), - }); - - return await res.json(); - } */ }