Skip to content

Commit b42dbfc

Browse files
committed
lib/auth/oauth2/strategy.ts
1 parent 9a1b33c commit b42dbfc

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/auth/oauth2/strategy.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ interface Oauth2Profile {
99
photo: string
1010
}
1111

12-
export function parseProfile(data: Record<string, string>): Oauth2Profile {
12+
// eslint-disable-next-line
13+
type ProfileData = Record<string, any> | string
14+
15+
export function parseProfile(data: ProfileData): Oauth2Profile {
1316
const username = extractProfileAttribute(data, config.oauth2.userProfileUsernameAttr) as string
1417
const displayName = extractProfileAttribute(data, config.oauth2.userProfileDisplayNameAttr) as string
1518
const email = extractProfileAttribute(data, config.oauth2.userProfileEmailAttr) as string
@@ -28,7 +31,7 @@ export function parseProfile(data: Record<string, string>): Oauth2Profile {
2831
}
2932
}
3033

31-
export function extractProfileAttribute(data: any, path: string): string | string[] | undefined {
34+
export function extractProfileAttribute(data: ProfileData, path: string): string | string[] | undefined {
3235
if (!data) return undefined
3336
if (typeof path !== 'string') return undefined
3437
// can handle stuff like `attrs[0].name`
@@ -44,7 +47,7 @@ export function extractProfileAttribute(data: any, path: string): string | strin
4447
}
4548
if (!data) return undefined
4649
}
47-
return data
50+
return data as string
4851
}
4952

5053
interface OAuth2CustomStrategyOptions extends StrategyOptions {

0 commit comments

Comments
 (0)