JWT fails with error: Failed to verify JWT. Invalid token: Incomplete segments
- 0
- Self Hosted
- Accounts
- Web
So I am trying to setup SSR authentication on my Nextjs project. The flow is:
- Authenticate using OAuth
- Get secret key from
/auth/oauth2/successand save as cookie
On page request:
- Get cookie (secret key)
- Set jwt using
client.setJWT(secretkey) - Get current user using
account.get()
Then I get this error: Failed to verify JWT. Invalid token: Incomplete segments
Yes because the session cookie is not the same thing as a JWT. You can't use them interchangeably
Basicly i think (my oppinion) that best way is to use appwrite sdk for client on server side. And when you want to implement your api key you just will have to use sdk for node.js
only think you have to do is to set header into appwrite client "X-Fallback-Cookies"
Recommended threads
- Middleware
how to make middleware in nextjs appwrite with client side auth?
- Error 400: redirect_uri_mismatch
Hi team, Google OAuth was working fine with our Appwrite Cloud setup until yesterday. We did not change any configuration in Appwrite, Google Cloud, or our cod...
- Auth not working on expo react native
I'm trying to launch a development server with expo go and appwrite as a backend. On my windows pc, I've got a local docker instance of appwrite running as my b...