Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux authored Feb 4, 2025
2 parents d4a58f8 + 6c5c4cd commit be8eb44
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/runtime/server/lib/oauth/microsoft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,17 @@ export function defineOAuthMicrosoftEventHandler({ config, onSuccess, onError }:
const redirectURL = config.redirectURL || getOAuthRedirectURL(event)

if (!query.code) {
const scope = config.scope && config.scope.length > 0 ? config.scope : ['User.Read']
config.scope = config.scope && config.scope.length > 0 ? config.scope : ['User.Read']
// guarantee uniqueness of the scope
config.scope = [...new Set(config.scope)]
// Redirect to Microsoft Oauth page
return sendRedirect(
event,
withQuery(authorizationURL as string, {
client_id: config.clientId,
response_type: 'code',
redirect_uri: redirectURL,
scope: scope.join(' '),
scope: config.scope.join(' '),
...config.authorizationParams,
}),
)
Expand Down

0 comments on commit be8eb44

Please sign in to comment.