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
- Session not found. Please run appwrite l...
I have encounter an issue with appwrite CLI They asking for a login session but in the doc, it’s mention that only setup client with endpoint / api key is enou...
- SELF HOSTING ISSUE, DATA NOT MIGRATING T...
Hey, devs, I recently tried to migrate my cloud instance to a self hosted version but my data is not transferred fully only the table structure is transferred ...
- No Document ID?
Hi I have a self hosted appwrite. My documents get a document ID but are not visible in the console. I don't know why this happens and how to fix this