Skip to content

Commit

Permalink
chore: rename to userURL
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux committed Mar 22, 2024
1 parent 407c0d6 commit 6ebe791
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/runtime/server/lib/oauth/google.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -65,10 +65,11 @@ export function googleEventHandler({
onError,
}: OAuthConfig<OAuthGoogleConfig>) {
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)
Expand Down Expand Up @@ -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}`,
Expand Down

0 comments on commit 6ebe791

Please sign in to comment.