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
- 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
- Weird permission failure
when creating an account I use following methods: ``` Future<void> register(String email, String password, String username) async { final user = await accoun...