#SSR Authentication | Appwrite

5 messages · Page 1 of 1 (latest)

eager totem
#

How to perform authentication with Appwrite? or with SSR?

In my layout file using this function I can verify that my user is signed in, but then I try the same with useTask it runs on server side and says the user is not logged in, which makes sense. How can I make it work on both ends?

useVisibleTask$(async () => {
    await AppwriteService.getAccount();
  });

Also how can I implement good routing and security protocols to ensure that the user attribute is accessible on both ends to make authenticated api calls easier? I do not understand Qwik very well yet, if I can do this with state or context, I would really appreciate if you can explain how that would work!!!

crimson hound
normal dagger
crimson hound
#

At the moment I don't, I use onRequest and inside I get JWT tokens from API and set them to cookie. If API throws error about JWT token, I show error page or redirect somewhere else.

eager totem
#

How would I log the user in with Oauth, on both client and server side?