
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
- Auth Error
"use client"; import { useEffect } from "react"; import { getSessionCookie } from "@/actions/auth"; import { createBrowserSessionClient } from "@/lib/appwrite-...
- Cannot connect to SMTP in AppWrite - set...
This used to work and then at some point it stopped. One thing that happened in that time was moving my application to Vercel. I have read on another thread t...
- [Self Hosted]
fresh instance of Appwrite - cant deploy function from local to instance ✗ Error • func2 (68134cd9002358f96e4a) • Invalid `specification` p...
