Skip to content

Commit

Permalink
fix: don't use session.user object in _getAuthenticatorAssuranceLevel()
Browse files Browse the repository at this point in the history
Causing warnings
  • Loading branch information
kizivat committed May 14, 2024
1 parent 4ecfdda commit 0baa856
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/GoTrueClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2545,8 +2545,19 @@ export default class GoTrueClient {

let nextLevel: AuthenticatorAssuranceLevels | null = currentLevel

const {
data: { user },
error: userError,
} = await this._getUser()
if (userError) {
return { data: null, error: userError }
}
if (!user) {
return { data: { currentLevel, nextLevel, currentAuthenticationMethods: [] }, error: null }
}

const verifiedFactors =
session.user.factors?.filter((factor: Factor) => factor.status === 'verified') ?? []
user.factors?.filter((factor: Factor) => factor.status === 'verified') ?? []

if (verifiedFactors.length > 0) {
nextLevel = 'aal2'
Expand Down

0 comments on commit 0baa856

Please sign in to comment.