
Hi everyone, I've been looking for the past day for solutions to my error in my code with making Discord and Appwrite work on my NextJS project. This project is just a clicker and I'm trying to setup the OAuth so you can't just click without being signed in. I'm not sure why my code doesn't work, but here it is. Also, all of my code provided is from my page.js
and that's the only page I have.
loginWithDiscord Function
const loginWithDiscord = async () => {
try {
await account.createOAuth2Session(
OAuthProvider.Discord,
'http://localhost:3000', // Redirect URL
'http://localhost:3000', // Success URL
['identify', 'email'] // Scopes
);
} catch (error) {
console.error('Error logging in with Discord:', error);
}
};
useEffect for fetching user + clicks
useEffect(() => {
const getUser = async () => {
try {
const user = await account.get();
setUser(user);
fetchClicks();
} catch (error) {
console.error('Error fetching session:', error);
}
};
getUser();
}, []);
Thanks if you can!
Recommended threads
- How To Send Email Verification From Serv...
How can I send email verification from server action or component after sign up in next.js ? Is there any way ?
- Site don't have Permission?
https://discord.com/channels/564160730845151244/564160731327758347/1386878747902476489 I'm on a self hosted Instance of Appwrite 1.7.4 and getting this error o...
- Add custom domain problem
I am trying to use Appwrite in a self-hosted environment and am having difficulty adding a custom domain. Steps taken: Project > Settings > Custom Domains > Add...
