From 6ebe79188c4998474e929c894599a70595ee3569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Fri, 22 Mar 2024 19:58:12 +0100 Subject: [PATCH] chore: rename to userURL --- src/runtime/server/lib/oauth/google.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/runtime/server/lib/oauth/google.ts b/src/runtime/server/lib/oauth/google.ts index 3c323134..2403bc6c 100644 --- a/src/runtime/server/lib/oauth/google.ts +++ b/src/runtime/server/lib/oauth/google.ts @@ -46,10 +46,10 @@ export interface OAuthGoogleConfig { tokenURL?: string; /** - * Google OAuth User Info URL + * Google OAuth User URL * @default 'https://www.googleapis.com/oauth2/v3/userinfo' */ - userInfoURL?: string; + userURL?: string; /** * Extra authorization parameters to provide to the authorization URL @@ -65,10 +65,11 @@ export function googleEventHandler({ onError, }: OAuthConfig) { return eventHandler(async (event: H3Event) => { + // @ts-ignore config = defu(config, useRuntimeConfig(event).oauth?.google, { authorizationURL: 'https://accounts.google.com/o/oauth2/v2/auth', tokenURL: 'https://oauth2.googleapis.com/token', - userInfoURL: 'https://www.googleapis.com/oauth2/v3/userinfo', + userURL: 'https://www.googleapis.com/oauth2/v3/userinfo', authorizationParams: {} }) as OAuthGoogleConfig const { code } = getQuery(event) @@ -125,7 +126,7 @@ export function googleEventHandler({ const accessToken = tokens.access_token const user: any = await ofetch( - config.userInfoURL, + config.userURL as string, { headers: { Authorization: `Bearer ${accessToken}`,