Skip to content

Commit 1d95af3

Browse files
mendrinosatinux
andauthored
fix(oauth, facebook): prevent duplication of config.fields and config.scope in defu merge (#375)
Co-authored-by: Sébastien Chopin <[email protected]>
1 parent c7ce610 commit 1d95af3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/runtime/server/lib/oauth/facebook.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export function defineOAuthFacebookEventHandler({
8888
const redirectURL = config.redirectURL || getOAuthRedirectURL(event)
8989

9090
if (!query.code) {
91-
config.scope = config.scope || []
91+
config.scope = [...new Set(config.scope)]
9292
// Redirect to Facebook Oauth page
9393
return sendRedirect(
9494
event,
@@ -117,7 +117,7 @@ export function defineOAuthFacebookEventHandler({
117117
const accessToken = tokens.access_token
118118
// TODO: improve typing
119119

120-
config.fields = config.fields || ['id', 'name']
120+
config.fields = [...new Set(config.fields || ['id', 'name'])]
121121
const fields = config.fields.join(',')
122122

123123
const user = await $fetch(

0 commit comments

Comments
 (0)