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
Let me try this also
Did, not working
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;
auth.js
register.js
try {
await authService.getUserInfo();
} catch (error) {
console.log(`Error while Fetching user: ${error}`);
}
};
useEffect(() => {
getUser();
}, []);
This is my code
Do you get error logging in?
Are you using any framework?
Vite + React
I see. As long as you don't use any SSR feature it will be fine
Okay
You're trying to get current user info, true?
Try using account.get(); instead. Let's see if it works
wait
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
It's just these two requests
there should be some more. it wont be a fetch request. probably a doc request
where can I see them?
Recommended threads
- Get team fail in appwrite function
I try to get team of a user inside appwrite function, but i get this error: `AppwriteException: User (role: guests) missing scope (teams.read)` If i try on cl...
- Deploy function not working - 503
Hellon i get this error message, when i try to deploy a new version of a function <html><body><h1>503 Service Unavailable</h1>No server is available to handle...
- Error When load the website
Hi, I am getting this error whenever I reload my website please help me, I am using react Error: ** GET https://cloud.appwrite.io/v1/account 401 (Unauthoriz...