Update login with multiple auth methods to toggle button and logic

This commit is contained in:
Tuan Dang
2023-08-12 13:53:55 +07:00
parent 69605a1a54
commit dbd55441f2
15 changed files with 384 additions and 429 deletions
+1 -3
View File
@@ -407,10 +407,8 @@ export const validateProviderAuthToken = async ({
jwt.verify(providerAuthToken, await getJwtProviderAuthSecret())
);
let authProviders = [...(user.authProviders || []), user.authProvider];
if (
!authProviders.includes(decodedToken.authProvider) ||
!user.authMethods.includes(decodedToken.authProvider) ||
decodedToken.email !== email
) {
throw new Error("Invalid authentication credentials.")