I can log in successful via LinkedIn OAuth and redirected back the successful url, and the user appears in Appwrite Cloud Auth section but getSession("current")
throws a 401
Steps to reproduce...
- click login
- redirected to LinkedIn and login
- redirected to successul url on my app
- use
getSession("current")
throws a401
const getAppwriteUser = async () => {
let session = {};
try {
session = await account.getSession("current");
let linkedinUser = {};
if (session) {
// fake data, get real profile info from LinkedIn
linkedinUser = {
imageUrl: "https://github.com/eddiejaoude.png",
name: "TEST",
email: "email TEST",
};
}
setUser(linkedinUser);
} catch (e) {
console.log(e);
setUser(null);
}
};
useEffect(() => {
getAppwriteUser();
}, []);
Console error
Failed to load resource: the server responded with a status of 401 ()
What does your code for authenticating look like?
const login = async () => {
account.createOAuth2Session(
"linkedin",
`${process.env.NEXT_PUBLIC_BASE_URL}/success`,
`${process.env.NEXT_PUBLIC_BASE_URL}/failure`
);
};
I am able to log in on LinkedIn and redirected back to /success
and my user was created in Appwrite Cloud
Recommended threads
- delete document problems
i don't know what's going on but i get an attribute "tournamentid" not found in the collection when i try to delet the document... but this is just the document...
- Update User Error
```ts const { users, databases } = await createAdminClient(); const session = await getLoggedInUser(); const user = await users.get(session.$id); if (!use...
- apple exchange code to token
hello guys, im new here π I have created a project and enabled apple oauth, filled all data (client id, key id, p8 file itself etc). I generate oauth code form...