Clarified some oauth things in the docs (#9203)

This commit is contained in:
Aiden Foxx
2021-10-27 23:38:06 +02:00
committed by GitHub
parent eed8c0bf97
commit fc3e24be12
3 changed files with 28 additions and 33 deletions

View File

@@ -98,9 +98,9 @@ export class OAuth2AuthDriver extends LocalAuthDriver {
const { emailKey, identifierKey, allowPublicRegistration } = this.config;
const email = userInfo[emailKey ?? 'email'] as string | undefined;
const email = userInfo[emailKey ?? 'email'] as string | null | undefined;
// Fallback to email if explicit identifier not found
const identifier = (userInfo[identifierKey] as string | undefined) ?? email;
const identifier = (userInfo[identifierKey] as string | null | undefined) ?? email;
if (!identifier) {
logger.warn(`Failed to find user identifier for provider "${this.config.provider}"`);

View File

@@ -99,9 +99,9 @@ export class OpenIDAuthDriver extends LocalAuthDriver {
const { identifierKey, allowPublicRegistration, requireVerifiedEmail } = this.config;
const email = userInfo.email as string;
const email = userInfo.email as string | null | undefined;
// Fallback to email if explicit identifier not found
const identifier = (userInfo[identifierKey ?? 'sub'] as string | undefined) ?? email;
const identifier = (userInfo[identifierKey ?? 'sub'] as string | null | undefined) ?? email;
if (!identifier) {
logger.warn(`Failed to find user identifier for provider "${this.config.provider}"`);