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
- Any way to temporarily bypass the email ...
Hey guys, any way to bypass the email verification to use the accounts again? i need to recover some projects that due to recent changes have been stopped, and ...
- Collections list not showing up when try...
I'm trying to create new relationship attribute but both one way and two way relationship is not showing up collections list to connect with my relationship att...
- I have try to use the appwrite in to the...
Invalid Origin. Register your new client (oailedjdbkhlkakmnnapoonllbnfmfij) as a new Web (Chrome Extension) platform on your project console dashboard