Integrate captcha token in password sign-in process

In this update, a captcha token is introduced in the password sign-in process to improve security. A `useCaptchaToken` hook has been added to the `PasswordSignInContainer` and corresponding adjustments have been made in the `useSignInWithEmailPassword` hook. The SignInWithPasswordCredentials type is now used for credentials instead of a locally defined interface.
This commit is contained in:
giancarlo
2024-04-28 00:04:06 +07:00
parent a2211c7e75
commit 2b2977f0c8
2 changed files with 12 additions and 9 deletions

View File

@@ -1,17 +1,14 @@
import type { SignInWithPasswordCredentials } from '@supabase/supabase-js';
import { useMutation } from '@tanstack/react-query';
import { useSupabase } from './use-supabase';
interface Credentials {
email: string;
password: string;
}
export function useSignInWithEmailPassword() {
const client = useSupabase();
const mutationKey = ['auth', 'sign-in-with-email-password'];
const mutationFn = async (credentials: Credentials) => {
const mutationFn = async (credentials: SignInWithPasswordCredentials) => {
const response = await client.auth.signInWithPassword(credentials);
if (response.error) {