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
- is `account.get()` safe to be used in th...
I want to user's `id` for authentication. However, a while ago I was told in this server not to use `account.get()` and instead add user preferences for that us...
- Usage of the new Client() and dealing wi...
Hey guys, just a quick one - we had some web traffic the other day and it ended up bombing out - To put in perspective of how the app works, we have a Nuxt Ap...
- CORS errors in Obsidian custom plugin
Hi, anyone here familiar with obsidian community plugins? In short: it's a local first note app which supports writing your own add-ons / plugin But I keep get...