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
- Paused project can't activate
I have failed to reactivate one my projects which had been paused
- Site deployment keeps getting failed
Hi good folks, need a hand with Sites deploy Error on every deploy: Synchronous function execution timed out... duration doesn't exceed 30 seconds [exact log ...
- Unknown attribute type: varchar / text
Since the `string` type is deprecated I tried using `varchar` and `text` in some newer tables, but when running `appwrite pull tables && appwrite types ./src/li...