So I create a session using this code: js
export const loginOauth = () => {
account.createOAuth2Session(OAuthProvider.Google, 'http://localhost:5173/redirect', 'http://localhost:5173/error')
}
and then after the user gets redirected, I want to save his data in the database, using this function: ```js
export const checkSession = async () => {
try {
const s = await account.getSession('current');
console.log("Session:", s);
return s;
} catch (error) {
console.error("No active session found:", error);
throw error;
}
};
export const saveAccount = async () => { const s = await checkSession();
try {
await database.getDocument('database', 'users', s.userId);
} catch {
const a = await account.get()
await database.createDocument('database', 'users', s.userId, {
name: a.name,
email: a.email,
recovery: ''
},
[read("any")])
} }``` in return I get these errors, any sugestions what I might be doing wrong? The accounts are actually created on the platform
All of the functions are also in the same file, if this might be the cause
Recommended threads
- Getting current user has been blocked
Getting current user has been blocked error while signing in the appwrite console. Got this during I am testing with the my saas web project. Please help to unb...
- vorafy.studio domain already exists erro...
My domain vorafy.studio is stuck/locked from a previously deleted project. I created a new project but can't add the domain — getting 'already exists' error. Pl...
- How can I disable client-side account re...
Hi everyone! I’m currently building a game backend using Appwrite, and I’d like to prevent users from creating new accounts directly through the client. My go...