
I'm trying to login a User using google auth after setting up everything in the google cloud console still the user that doesn't exist in the appwrite gets redirect to the dashboard page instead of signup page below is the code.
`import { Client, Account, ID } from "appwrite"; import config from "../conf/config"; const client = new Client(); const account = new Account(client);
client.setEndpoint(config.appwriteURL).setProject(config.appwriteProjectID);
export class authService{
oAuth(){
try {
account.createOAuth2Session('google','http://localhost:3000/dashboard', 'http://localhost:3000/signup')
} catch (error) {
console.log(error)
return false
}
}
}
const authServices = new authService(); export default authServices;`
`"use client" import authServices from "../../authentication/auth"; import styles from "./styles.module.css"; import { useState } from "react" import { useRouter } from "next/navigation";
const Login = () => {
const googleAuth = (e) => {
e.preventDefault()
try {
authServices.oAuth()
} catch (error) {
console.log(error)
}
}
return (
<div className={styles.Login}
<h3>Login Using Google</h3>
<button onClick={(e) => googleAuth(e)}>Google Login</button>
</div>
)
}
export default Login;`

Btw, it's best to use 3 back ticks with multi-line code. See https://www.markdownguide.org/extended-syntax/#syntax-highlighting

That's weird...if they're redirected to the success url, the user should have been created. Are you sure you're looking at the right project?

Yup I tried a few times but even after signing in with a new email id everytime which doesn't exist in the appwrite it gets logged in where am I making the mistake 😔

What's the Appwrite URL and project id in your code? Please share a screenshot of the Appwrite console auth page including the URL

APPWRITE_URL = https://cloud.appwrite.io/v1 PROJECT_ID = 64e343b9a0abb92ce533
and the appwrite console auth page means the google 0auth settings screenshot ?

No the page that shows users in your Appwrite project


I tried github login as well it gets succesfully logged in but I cannot see any user that exist in the appwrite auth with the same email id that was used to sign in to github or google

take a look at this also

okay so the github login is working and I can see the user in the appwrite db but the google is still not working

Okay so I tried in a new private window on my browser and it somehow worked don't know where was the error but it eventually worked thanks for replying @Steven :appwriteparty: :appwriterocket:

Ah you might have had a previous session that was getting reused
Recommended threads
- Auth Error
"use client"; import { useEffect } from "react"; import { getSessionCookie } from "@/actions/auth"; import { createBrowserSessionClient } from "@/lib/appwrite-...
- Prevent modifying specific attributes
How do I prevent user to only to be able to modify some of the attributes. Document level security gives full access to update whole document, what are the wor...
- Bypass Error When Creating Account With ...
Suppose user first uses email/pass for log in using xyz@gmail.com, few month later on decides to use google oauth2 with same xyz@gmail.com (or in reverse orde...
