Correct SSO linking case and uncomment audit logs v2

This commit is contained in:
Tuan Dang
2023-08-17 01:24:41 +07:00
parent c5b1e7298e
commit 5ac1816392
4 changed files with 9 additions and 16 deletions
+1 -6
View File
@@ -392,11 +392,9 @@ export const createToken = ({
export const validateProviderAuthToken = async ({
email,
user,
providerAuthToken,
}: {
email: string;
user: IUser,
providerAuthToken?: string;
}) => {
if (!providerAuthToken) {
@@ -407,10 +405,7 @@ export const validateProviderAuthToken = async ({
jwt.verify(providerAuthToken, await getJwtProviderAuthSecret())
);
if (
!user.authMethods.includes(decodedToken.authMethod) ||
decodedToken.email !== email
) {
if (decodedToken.email !== email) {
throw new Error("Invalid authentication credentials.")
}
}