My problem is that one app is used for authenticat...
# support-questions-legacy
f
My problem is that one app is used for authentication. Other apps should not handle authentication but their routes should be protected. If I want to check that email verification claim is there, on client or admin app, check will fail beacuse recipe is not initialized on those apps.
Copy code
super({
            key: "st-ev",
            async fetchValue(userId, _, userContext) {
                const recipe = EmailVerificationRecipe.getInstanceOrThrowError();
                let emailInfo = await recipe.getEmailForUserId(userId, userContext);

                if (emailInfo.status === "OK") {
                    return recipe.recipeInterfaceImpl.isEmailVerified({ userId, email: emailInfo.email, userContext });
                } else if (emailInfo.status === "EMAIL_DOES_NOT_EXIST_ERROR") {
                    // We consider people without email addresses as validated
                    return true;
                } else {
                    throw new Error("UNKNOWN_USER_ID");
                }
            },
            defaultMaxAgeInSeconds: 300,
        });
5 Views