I have just implemented the SSR authentication flow for Next.js.
I have two providers, GitHub and Discord.
With GitHub everything works flawlessly. The user is logged in already on redirect.
With Discord, however, the user object returned from this function is null.
export const getLoggedInUser = cache(async () => {
try {
const { account } = await createSessionClient();
return await account.get();
} catch (error) {
return null;
}
});
I have to refresh the page, and then the user object is retrieved and the user is logged in.
I've looked at the HTTP Request objects in dev tools, and most apparent difference are the referrer policies.
The redirect urls from GitHub are origin-when-cross-origin
while the ones from Discord are strict-origin-when-cross-origin
.
I have only tested this in a local development environment.
Recommended threads
- Use different email hosts for different ...
Hello, I have 2 projects and i want to be able to set up email templates in the projects. Both projects will have different email host configurations. I see ...
- 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...
- Deep Linking & Password reset
I am using react native with expo. I want to implement deep link with the url recived via email. So when clicked the link it opens my app. I havent ever used de...