Skip to content
Back

SignUp with Google oAuth

  • 0
  • Auth
  • Web
_DEMON
5 Dec, 2024, 16:10

I am trying to create an account with google sign in , the account is getting created but i am not able to log it to console and the dispatch method is also not working

const signupWithGoogle = async () => { try { const userData = await authService.OAuth2Login(); if (userData) { const userData = await authService.getCurrentUser(); console.log(userData); if (userData) dispatch(login(userData)); navigate("/"); } } catch (error) { setError(error.message); } };

TypeScript
async OAuth2Login(provider) {
    try {
        const user = await this.account.createOAuth2Session(OAuthProvider.Google, "http://localhost:5173");
        return user;
    } catch (error) {
        throw error;
    }
}
TL;DR
Issue: Unable to log account creation with Google Sign In to console, and dispatch method is not working after account creation. Solution: It seems like there might be a variable redeclaration issue with `userData`. Try renaming the variable in the relevant if block. Additionally, check if `dispatch` is correctly set up in the function scope.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more