Rank 2: Process
Yes, But it worked for me for the first time I implemented it
Votes
6
Replies
24
Participants
Unknown
Messages
25
Rank 2: Process
Yes, But it worked for me for the first time I implemented it
Then probably creating a new project should solve it
Except if it's an issue with your code
Rank 2: Process
Let me try this also
Rank 2: Process
Did, not working
Rank 2: Process
import { Account, Client } from "appwrite";import appwriteConf from "../config/appwriteConfig";
export class AuthService { client = new Client(); account;
constructor() { this.client .setEndpoint(appwriteConf.appwriteAPI) .setProject(appwriteConf.appwriteProjectId);
this.account = new Account(this.client); }
async signInWithGoogle() { try { return this.account.createOAuth2Session( "google", "http://localhost:5173/register", "http://localhost:5173/" ); } catch (error) { console.log(`Error while logging In: ${error}`); } }
async getUserInfo() { try { const session = await this.account.getSession('current'); console.log(session); return session; } catch (error) { console.log(`Error while Fetching user: ${error}`); } }}
const authService = new AuthService();
export default authService;Rank 2: Process
auth.js
Rank 2: Process
register.js
try { await authService.getUserInfo(); } catch (error) { console.log(`Error while Fetching user: ${error}`); } };
useEffect(() => { getUser(); }, []);Rank 2: Process
This is my code
Do you get error logging in?
Are you using any framework?
Rank 2: Process
Vite + React
Rank 2: Process
I see. As long as you don't use any SSR feature it will be fine
Rank 2: Process
Okay
You're trying to get current user info, true?
Try using account.get(); instead. Let's see if it works
Rank 2: Process
wait
Rank 2: Process
same error
Would you please sign in using oauth, but have the network logs open to capture all of the network requests? I think the request that sets the cookie is the /redirect request. Look in the response headers of that request to see what the set cookie is
Rank 2: Process
It's just these two requests
Rank 2: Process
there should be some more. it wont be a fetch request. probably a doc request
Rank 2: Process
where can I see them?