From 53c5ead47d7735e84a818c9058674b9b84e865d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Sat, 17 Feb 2024 16:42:43 +0100 Subject: [PATCH 1/2] feat: add authorizationParams in oauth config --- playground/app.vue | 22 +++++++++---------- playground/auth.d.ts | 21 +++++++++--------- playground/server/routes/auth/auth0.get.ts | 2 +- .../server/routes/auth/battledotnet.get.ts | 2 +- playground/server/routes/auth/cognito.get.ts | 2 +- playground/server/routes/auth/discord.get.ts | 2 +- playground/server/routes/auth/github.get.ts | 2 +- playground/server/routes/auth/google.get.ts | 7 +++++- playground/server/routes/auth/keycloak.get.ts | 2 +- playground/server/routes/auth/linkedin.get.ts | 2 +- .../server/routes/auth/microsoft.get.ts | 5 ++--- playground/server/routes/auth/spotify.get.ts | 2 +- playground/server/routes/auth/twitch.get.ts | 2 +- src/runtime/server/lib/oauth/auth0.ts | 13 +++++++++-- src/runtime/server/lib/oauth/battledotnet.ts | 9 +++++++- src/runtime/server/lib/oauth/cognito.ts | 12 ++++++++-- src/runtime/server/lib/oauth/discord.ts | 13 +++++++++-- src/runtime/server/lib/oauth/github.ts | 13 +++++++++-- src/runtime/server/lib/oauth/google.ts | 9 ++++++++ src/runtime/server/lib/oauth/keycloak.ts | 14 +++++++----- src/runtime/server/lib/oauth/linkedin.ts | 9 +++++++- src/runtime/server/lib/oauth/microsoft.ts | 16 ++++++++++---- src/runtime/server/lib/oauth/spotify.ts | 13 +++++++++-- src/runtime/server/lib/oauth/twitch.ts | 13 +++++++++-- src/runtime/types/oauth-config.ts | 3 +-- 25 files changed, 151 insertions(+), 59 deletions(-) diff --git a/playground/app.vue b/playground/app.vue index f92cf87e..5d83fac0 100644 --- a/playground/app.vue +++ b/playground/app.vue @@ -3,67 +3,67 @@ const { loggedIn, user, session, clear } = useUserSession() const providers = computed(() => [ { - label: session.value.user?.github?.login || 'GitHub', + label: session.value.user?.github || 'GitHub', to: '/auth/github', disabled: Boolean(user.value?.github), icon: 'i-simple-icons-github', }, { - label: session.value.user?.spotify?.display_name || 'Spotify', + label: session.value.user?.spotify || 'Spotify', to: '/auth/spotify', disabled: Boolean(user.value?.spotify), icon: 'i-simple-icons-spotify', }, { - label: session.value.user?.google?.email || 'Google', + label: session.value.user?.google || 'Google', to: '/auth/google', disabled: Boolean(user.value?.google), icon: 'i-simple-icons-google', }, { - label: session.value.user?.twitch?.login || 'Twitch', + label: session.value.user?.twitch || 'Twitch', to: '/auth/twitch', disabled: Boolean(user.value?.twitch), icon: 'i-simple-icons-twitch', }, { - label: user.value?.auth0?.email || 'Auth0', + label: user.value?.auth0 || 'Auth0', to: '/auth/auth0', disabled: Boolean(user.value?.auth0), icon: 'i-simple-icons-auth0', }, { - label: user.value?.discord?.username || 'Discord', + label: user.value?.discord || 'Discord', to: '/auth/discord', disabled: Boolean(user.value?.discord), icon: 'i-simple-icons-discord', }, { - label: user.value?.battledotnet?.battletag || 'Battle.net', + label: user.value?.battledotnet || 'Battle.net', to: '/auth/battledotnet', disabled: Boolean(user.value?.battledotnet), icon: 'i-simple-icons-battledotnet', }, { - label: user.value?.microsoft?.displayName || 'Microsoft', + label: user.value?.microsoft || 'Microsoft', to: '/auth/microsoft', disabled: Boolean(user.value?.microsoft), icon: 'i-simple-icons-microsoft', }, { - label: user.value?.keycloak?.preferred_username || 'Keycloak', + label: user.value?.keycloak || 'Keycloak', to: '/auth/keycloak', disabled: Boolean(user.value?.keycloak), icon: 'i-simple-icons-redhat' }, { - label: user.value?.linkedin?.email || 'LinkedIn', + label: user.value?.linkedin || 'LinkedIn', to: '/auth/linkedin', disabled: Boolean(user.value?.linkedin), icon: 'i-simple-icons-linkedin', }, { - label: user.value?.cognito?.email || 'Cognito', + label: user.value?.cognito || 'Cognito', to: '/auth/cognito', disabled: Boolean(user.value?.cognito), icon: 'i-simple-icons-amazonaws', diff --git a/playground/auth.d.ts b/playground/auth.d.ts index c873254a..23a0a0a8 100644 --- a/playground/auth.d.ts +++ b/playground/auth.d.ts @@ -1,15 +1,16 @@ declare module '#auth-utils' { interface User { - spotify?: any - github?: any - google?: any - twitch?: any - auth0?: any - microsoft?: any; - discord?: any - battledotnet?: any - keycloak?: any - linkedin?: any + spotify?: string + github?: string + google?: string + twitch?: string + auth0?: string + microsoft?: string + discord?: string + battledotnet?: string + keycloak?: string + linkedin?: string + cognito?: string } interface UserSession { diff --git a/playground/server/routes/auth/auth0.get.ts b/playground/server/routes/auth/auth0.get.ts index e8b34090..bbb37870 100644 --- a/playground/server/routes/auth/auth0.get.ts +++ b/playground/server/routes/auth/auth0.get.ts @@ -5,7 +5,7 @@ export default oauth.auth0EventHandler({ async onSuccess(event, { user }) { await setUserSession(event, { user: { - auth0: user, + auth0: user.email }, loggedInAt: Date.now() }) diff --git a/playground/server/routes/auth/battledotnet.get.ts b/playground/server/routes/auth/battledotnet.get.ts index 53acf17a..021eeeb9 100644 --- a/playground/server/routes/auth/battledotnet.get.ts +++ b/playground/server/routes/auth/battledotnet.get.ts @@ -2,7 +2,7 @@ export default oauth.battledotnetEventHandler({ async onSuccess(event, { user }) { await setUserSession(event, { user: { - battledotnet: user, + battledotnet: user.battletag }, loggedInAt: Date.now() }) diff --git a/playground/server/routes/auth/cognito.get.ts b/playground/server/routes/auth/cognito.get.ts index 1785d41c..b7bd71f8 100644 --- a/playground/server/routes/auth/cognito.get.ts +++ b/playground/server/routes/auth/cognito.get.ts @@ -2,7 +2,7 @@ export default oauth.cognitoEventHandler({ async onSuccess(event, { user }) { await setUserSession(event, { user: { - cognito: user, + cognito: user.email }, loggedInAt: Date.now() }) diff --git a/playground/server/routes/auth/discord.get.ts b/playground/server/routes/auth/discord.get.ts index e5a013b9..2fe4fd9a 100644 --- a/playground/server/routes/auth/discord.get.ts +++ b/playground/server/routes/auth/discord.get.ts @@ -2,7 +2,7 @@ export default oauth.discordEventHandler({ async onSuccess(event, { user }) { await setUserSession(event, { user: { - discord: user, + discord: user.username }, loggedInAt: Date.now() }) diff --git a/playground/server/routes/auth/github.get.ts b/playground/server/routes/auth/github.get.ts index fa5438ad..46069d96 100644 --- a/playground/server/routes/auth/github.get.ts +++ b/playground/server/routes/auth/github.get.ts @@ -2,7 +2,7 @@ export default oauth.githubEventHandler({ async onSuccess(event, { user }) { await setUserSession(event, { user: { - github: user, + github: user.login }, loggedInAt: Date.now() }) diff --git a/playground/server/routes/auth/google.get.ts b/playground/server/routes/auth/google.get.ts index a7ec6f4f..1655d1b6 100644 --- a/playground/server/routes/auth/google.get.ts +++ b/playground/server/routes/auth/google.get.ts @@ -1,8 +1,13 @@ export default oauth.googleEventHandler({ + config: { + authorizationParams: { + access_type: 'offline' + } + }, async onSuccess(event, { user }) { await setUserSession(event, { user: { - google: user, + google: user.email }, loggedInAt: Date.now() }) diff --git a/playground/server/routes/auth/keycloak.get.ts b/playground/server/routes/auth/keycloak.get.ts index 9bc281c6..513af834 100644 --- a/playground/server/routes/auth/keycloak.get.ts +++ b/playground/server/routes/auth/keycloak.get.ts @@ -2,7 +2,7 @@ export default oauth.keycloakEventHandler({ async onSuccess(event, { user }) { await setUserSession(event, { user: { - keycloak: user, + keycloak: user.preferred_username }, loggedInAt: Date.now(), }) diff --git a/playground/server/routes/auth/linkedin.get.ts b/playground/server/routes/auth/linkedin.get.ts index cd501f1b..14763e21 100644 --- a/playground/server/routes/auth/linkedin.get.ts +++ b/playground/server/routes/auth/linkedin.get.ts @@ -5,7 +5,7 @@ export default oauth.linkedinEventHandler({ async onSuccess(event, { user }) { await setUserSession(event, { user: { - linkedin: user, + linkedin: user.email }, loggedInAt: Date.now() }) diff --git a/playground/server/routes/auth/microsoft.get.ts b/playground/server/routes/auth/microsoft.get.ts index bf071a61..93f9d5fd 100644 --- a/playground/server/routes/auth/microsoft.get.ts +++ b/playground/server/routes/auth/microsoft.get.ts @@ -2,12 +2,11 @@ export default oauth.microsoftEventHandler({ async onSuccess(event, { user }) { await setUserSession(event, { user: { - microsoft: user, + microsoft: user.email }, loggedInAt: Date.now() }) - + return sendRedirect(event, '/') } }) - \ No newline at end of file diff --git a/playground/server/routes/auth/spotify.get.ts b/playground/server/routes/auth/spotify.get.ts index f31ba283..37d1e5f8 100644 --- a/playground/server/routes/auth/spotify.get.ts +++ b/playground/server/routes/auth/spotify.get.ts @@ -2,7 +2,7 @@ export default oauth.spotifyEventHandler({ async onSuccess(event, { user }) { await setUserSession(event, { user: { - spotify: user, + spotify: user.id }, loggedInAt: Date.now() }) diff --git a/playground/server/routes/auth/twitch.get.ts b/playground/server/routes/auth/twitch.get.ts index 79ce81d0..8410cf29 100644 --- a/playground/server/routes/auth/twitch.get.ts +++ b/playground/server/routes/auth/twitch.get.ts @@ -5,7 +5,7 @@ export default oauth.twitchEventHandler({ async onSuccess(event, { user }) { await setUserSession(event, { user: { - twitch: user, + twitch: user.login }, loggedInAt: Date.now() }) diff --git a/src/runtime/server/lib/oauth/auth0.ts b/src/runtime/server/lib/oauth/auth0.ts index 397321ae..ddfd014c 100644 --- a/src/runtime/server/lib/oauth/auth0.ts +++ b/src/runtime/server/lib/oauth/auth0.ts @@ -52,12 +52,20 @@ export interface OAuthAuth0Config { * @example 'github' */ connection?: string + /** + * Extra authorization parameters to provide to the authorization URL + * @see https://auth0.com/docs/api/authentication#social + * @example { display: 'popup' } + */ + authorizationParams?: Record } export function auth0EventHandler({ config, onSuccess, onError }: OAuthConfig) { return eventHandler(async (event: H3Event) => { // @ts-ignore - config = defu(config, useRuntimeConfig(event).oauth?.auth0) as OAuthAuth0Config + config = defu(config, useRuntimeConfig(event).oauth?.auth0, { + authorizationParams: {} + }) as OAuthAuth0Config const { code } = getQuery(event) if (!config.clientId || !config.clientSecret || !config.domain) { @@ -87,7 +95,8 @@ export function auth0EventHandler({ config, onSuccess, onError }: OAuthConfig } export function battledotnetEventHandler({ config, onSuccess, onError }: OAuthConfig) { @@ -50,7 +55,8 @@ export function battledotnetEventHandler({ config, onSuccess, onError }: OAuthCo // @ts-ignore config = defu(config, useRuntimeConfig(event).oauth?.battledotnet, { authorizationURL: 'https://oauth.battle.net/authorize', - tokenURL: 'https://oauth.battle.net/token' + tokenURL: 'https://oauth.battle.net/token', + authorizationParams: {} }) as OAuthBattledotnetConfig const query = getQuery(event) @@ -94,6 +100,7 @@ export function battledotnetEventHandler({ config, onSuccess, onError }: OAuthCo scope: config.scope.join(' '), state: randomUUID(), // Todo: handle PKCE flow response_type: 'code', + ...config.authorizationParams }) ) } diff --git a/src/runtime/server/lib/oauth/cognito.ts b/src/runtime/server/lib/oauth/cognito.ts index e238e5e1..a874692a 100644 --- a/src/runtime/server/lib/oauth/cognito.ts +++ b/src/runtime/server/lib/oauth/cognito.ts @@ -32,12 +32,19 @@ export interface OAuthCognitoConfig { * @default [] */ scope?: string[] + /** + * Extra authorization parameters to provide to the authorization URL + * @see https://docs.aws.amazon.com/cognito/latest/developerguide/authorization-endpoint.html + */ + authorizationParams?: Record } export function cognitoEventHandler({ config, onSuccess, onError }: OAuthConfig) { return eventHandler(async (event: H3Event) => { // @ts-ignore - config = defu(config, useRuntimeConfig(event).oauth?.cognito) as OAuthCognitoConfig + config = defu(config, useRuntimeConfig(event).oauth?.cognito, { + authorizationParams: {} + }) as OAuthCognitoConfig const { code } = getQuery(event) if (!config.clientId || !config.clientSecret || !config.userPoolId || !config.region) { @@ -63,6 +70,7 @@ export function cognitoEventHandler({ config, onSuccess, onError }: OAuthConfig< redirect_uri: redirectUrl, response_type: 'code', scope: config.scope.join(' '), + ...config.authorizationParams }) ) } @@ -103,4 +111,4 @@ export function cognitoEventHandler({ config, onSuccess, onError }: OAuthConfig< user }) }) -} \ No newline at end of file +} diff --git a/src/runtime/server/lib/oauth/discord.ts b/src/runtime/server/lib/oauth/discord.ts index 325f5003..db92b33c 100644 --- a/src/runtime/server/lib/oauth/discord.ts +++ b/src/runtime/server/lib/oauth/discord.ts @@ -45,6 +45,13 @@ export interface OAuthDiscordConfig { * @default 'https://discord.com/api/oauth2/token' */ tokenURL?: string + + /** + * Extra authorization parameters to provide to the authorization URL + * @see 'https://discord.com/developers/docs/topics/oauth2#authorization-code-grant' + * @example { allow_signup: 'true' } + */ + authorizationParams?: Record } export function discordEventHandler({ config, onSuccess, onError }: OAuthConfig) { @@ -53,7 +60,8 @@ export function discordEventHandler({ config, onSuccess, onError }: OAuthConfig< config = defu(config, useRuntimeConfig(event).oauth?.discord, { authorizationURL: 'https://discord.com/oauth2/authorize', tokenURL: 'https://discord.com/api/oauth2/token', - profileRequired: true + profileRequired: true, + authorizationParams: {} }) as OAuthDiscordConfig const { code } = getQuery(event) @@ -83,7 +91,8 @@ export function discordEventHandler({ config, onSuccess, onError }: OAuthConfig< response_type: 'code', client_id: config.clientId, redirect_uri: redirectUrl, - scope: config.scope.join(' ') + scope: config.scope.join(' '), + ...config.authorizationParams }) ) } diff --git a/src/runtime/server/lib/oauth/github.ts b/src/runtime/server/lib/oauth/github.ts index 2082528e..b9628403 100644 --- a/src/runtime/server/lib/oauth/github.ts +++ b/src/runtime/server/lib/oauth/github.ts @@ -41,6 +41,13 @@ export interface OAuthGitHubConfig { * @default 'https://github.com/login/oauth/access_token' */ tokenURL?: string + + /** + * Extra authorization parameters to provide to the authorization URL + * @see https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps#1-request-a-users-github-identity + * @example { allow_signup: 'true' } + */ + authorizationParams?: Record } export function githubEventHandler({ config, onSuccess, onError }: OAuthConfig) { @@ -48,7 +55,8 @@ export function githubEventHandler({ config, onSuccess, onError }: OAuthConfig; } export function googleEventHandler({ @@ -56,6 +63,7 @@ export function googleEventHandler({ config = defu(config, useRuntimeConfig(event).oauth?.google, { authorizationURL: 'https://accounts.google.com/o/oauth2/v2/auth', tokenURL: 'https://oauth2.googleapis.com/token', + authorizationParams: {} }) as OAuthGoogleConfig const { code } = getQuery(event) @@ -79,6 +87,7 @@ export function googleEventHandler({ client_id: config.clientId, redirect_uri: redirectUrl, scope: config.scope.join(' '), + ...config.authorizationParams }) ) } diff --git a/src/runtime/server/lib/oauth/keycloak.ts b/src/runtime/server/lib/oauth/keycloak.ts index 406f05e1..c3621196 100644 --- a/src/runtime/server/lib/oauth/keycloak.ts +++ b/src/runtime/server/lib/oauth/keycloak.ts @@ -41,6 +41,10 @@ export interface OAuthKeycloakConfig { * @example ['openid'] */ scope?: string[] + /** + * Extra authorization parameters to provide to the authorization URL + */ + authorizationParams?: Record } export function keycloakEventHandler({ @@ -49,11 +53,10 @@ export function keycloakEventHandler({ onError, }: OAuthConfig) { return eventHandler(async (event: H3Event) => { - config = defu( - config, - // @ts-ignore - useRuntimeConfig(event).oauth?.keycloak - ) as OAuthKeycloakConfig + // @ts-ignore + config = defu(config, useRuntimeConfig(event).oauth?.keycloak, { + authorizationParams: {}, + }) as OAuthKeycloakConfig const query = getQuery(event) const { code } = query @@ -100,6 +103,7 @@ export function keycloakEventHandler({ redirect_uri: redirectUrl, scope: config.scope.join(' '), response_type: 'code', + ...config.authorizationParams, }) ) } diff --git a/src/runtime/server/lib/oauth/linkedin.ts b/src/runtime/server/lib/oauth/linkedin.ts index e3488f39..32df95f1 100644 --- a/src/runtime/server/lib/oauth/linkedin.ts +++ b/src/runtime/server/lib/oauth/linkedin.ts @@ -38,6 +38,11 @@ export interface OAuthLinkedInConfig { * @default 'https://www.linkedin.com/oauth/v2/accessToken' */ tokenURL?: string + /** + * Extra authorization parameters to provide to the authorization URL + * @see https://docs.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/context + */ + authorizationParams?: Record } interface OAuthConfig { @@ -52,6 +57,7 @@ export function linkedinEventHandler({ config, onSuccess, onError }: OAuthConfig config = defu(config, useRuntimeConfig(event).oauth?.linkedin, { authorizationURL: 'https://www.linkedin.com/oauth/v2/authorization', tokenURL: 'https://www.linkedin.com/oauth/v2/accessToken', + authorizationParams: {} }) as OAuthLinkedInConfig const { code } = getQuery(event) @@ -80,7 +86,8 @@ export function linkedinEventHandler({ config, onSuccess, onError }: OAuthConfig response_type: 'code', client_id: config.clientId, redirect_uri: redirectUrl, - scope: config.scope.join(' ') + scope: config.scope.join(' '), + ...config.authorizationParams }) ) } diff --git a/src/runtime/server/lib/oauth/microsoft.ts b/src/runtime/server/lib/oauth/microsoft.ts index 82c61be8..56fb2c63 100644 --- a/src/runtime/server/lib/oauth/microsoft.ts +++ b/src/runtime/server/lib/oauth/microsoft.ts @@ -29,22 +29,27 @@ export interface OAuthMicrosoftConfig { scope?: string[] /** * Microsoft OAuth Authorization URL - * @default https://login.microsoftonline.com/${tenant}/oauth2/v2.0/authorize + * @default 'https://login.microsoftonline.com/${tenant}/oauth2/v2.0/authorize' * @see https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow */ authorizationURL?: string /** * Microsoft OAuth Token URL - * @default https://login.microsoftonline.com/${tenant}/oauth2/v2.0/token + * @default 'https://login.microsoftonline.com/${tenant}/oauth2/v2.0/token' * @see https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow */ tokenURL?: string /** * Microsoft OAuth User URL - * @default https://graph.microsoft.com/v1.0/me + * @default 'https://graph.microsoft.com/v1.0/me' * @see https://docs.microsoft.com/en-us/graph/api/user-get?view=graph-rest-1.0&tabs=http */ userURL?: string + /** + * Extra authorization parameters to provide to the authorization URL + * @see https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow + */ + authorizationParams?: Record } interface OAuthConfig { @@ -56,7 +61,9 @@ interface OAuthConfig { export function microsoftEventHandler({ config, onSuccess, onError }: OAuthConfig) { return eventHandler(async (event: H3Event) => { // @ts-ignore - config = defu(config, useRuntimeConfig(event).oauth?.microsoft) as OAuthMicrosoftConfig + config = defu(config, useRuntimeConfig(event).oauth?.microsoft, { + authorizationParams: {} + }) as OAuthMicrosoftConfig const { code } = getQuery(event) if (!config.clientId || !config.clientSecret || !config.tenant) { @@ -83,6 +90,7 @@ export function microsoftEventHandler({ config, onSuccess, onError }: OAuthConfi response_type: 'code', redirect_uri: redirectUrl, scope: scope.join(' '), + ...config.authorizationParams }) ) } diff --git a/src/runtime/server/lib/oauth/spotify.ts b/src/runtime/server/lib/oauth/spotify.ts index 763e4725..e37c48de 100644 --- a/src/runtime/server/lib/oauth/spotify.ts +++ b/src/runtime/server/lib/oauth/spotify.ts @@ -41,6 +41,13 @@ export interface OAuthSpotifyConfig { * @default 'https://accounts.spotify.com/api/token' */ tokenURL?: string + + /** + * Extra authorization parameters to provide to the authorization URL + * @see 'https://developer.spotify.com/documentation/web-api/tutorials/code-flow' + * @example { show_dialog: 'true' } + */ + authorizationParams?: Record } export function spotifyEventHandler({ config, onSuccess, onError }: OAuthConfig) { @@ -48,7 +55,8 @@ export function spotifyEventHandler({ config, onSuccess, onError }: OAuthConfig< // @ts-ignore config = defu(config, useRuntimeConfig(event).oauth?.spotify, { authorizationURL: 'https://accounts.spotify.com/authorize', - tokenURL: 'https://accounts.spotify.com/api/token' + tokenURL: 'https://accounts.spotify.com/api/token', + authorizationParams: {} }) as OAuthSpotifyConfig const { code } = getQuery(event) @@ -74,7 +82,8 @@ export function spotifyEventHandler({ config, onSuccess, onError }: OAuthConfig< response_type: 'code', client_id: config.clientId, redirect_uri: redirectUrl, - scope: config.scope.join(' ') + scope: config.scope.join(' '), + ...config.authorizationParams }) ) } diff --git a/src/runtime/server/lib/oauth/twitch.ts b/src/runtime/server/lib/oauth/twitch.ts index 97473cbe..99ac20a8 100644 --- a/src/runtime/server/lib/oauth/twitch.ts +++ b/src/runtime/server/lib/oauth/twitch.ts @@ -44,6 +44,13 @@ export interface OAuthTwitchConfig { * @default 'https://id.twitch.tv/oauth2/token' */ tokenURL?: string + + /** + * Extra authorization parameters to provide to the authorization URL + * @see https://dev.twitch.tv/docs/authentication/getting-tokens-oauth/#authorization-code-grant-flow + * @example { force_verify: 'true' } + */ + authorizationParams?: Record } export function twitchEventHandler({ config, onSuccess, onError }: OAuthConfig) { @@ -51,7 +58,8 @@ export function twitchEventHandler({ config, onSuccess, onError }: OAuthConfig { +export interface OAuthConfig { config?: TConfig; onSuccess: ( event: H3Event, From ac9486e634ce12b39048d4016bff651acd082a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Sat, 17 Feb 2024 16:54:05 +0100 Subject: [PATCH 2/2] fix: improve GH error handling --- src/runtime/server/lib/oauth/github.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/runtime/server/lib/oauth/github.ts b/src/runtime/server/lib/oauth/github.ts index b9628403..1329e3fd 100644 --- a/src/runtime/server/lib/oauth/github.ts +++ b/src/runtime/server/lib/oauth/github.ts @@ -58,7 +58,17 @@ export function githubEventHandler({ config, onSuccess, onError }: OAuthConfig