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
- Clean install of 1.9.0 shows errors in a...
I just run a full clean install of Appwrite on my server following the Manual installation guide in the docs page. The console seems to work, visually there d...
- Setup custom domain on selfhosted behind...
Hello everyone, can anyone help me to setup a custom domain on a selfhosted appwrite instance thats running behind cloudflare tunnels? Current setup: Appwrite r...
- Why does this happen?
`AppwriteException: general_argument_invalid, Invalid `secret` param: Value must be a valid string and at least 1 chars and no longer than 256 chars (400)` the...