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
- Different appwrite IDs are getting expos...
File_URL_FORMAT= https://cloud.appwrite.io/v1/storage/buckets/[BUCKET_ID]/files/[FILE_ID]/preview?project=[PROJECT_ID] I'm trying to access files in my web app...
- Invalid document structure: missing requ...
I just pick up my code that's working a week ago, and now I got this error: ``` code: 400, type: 'document_invalid_structure', response: { message: 'Inv...
- custom domain with CloudFlare
Hi all, it seems that CloudFlare has blocked cross-domain CNAME link which made my app hostname which is in CloudFlare, unable to create a CNAME pointing to clo...