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/success
and 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
- Use cloudflare origin certificate instea...
Hello! Is it possible to use cloudflare origin certificates instead of let's encrypt? We manage all ssl certs in our cloudflare account and our VMs has a firewa...
- Error getting session: AppwriteException...
I get this error `Error getting session: AppwriteException: User (role: guests) missing scope (account)` when running in prod. As soon as I try running my app o...
- Unable to View / Edit Bucket Files
Hi! I am unable to view / edit Bucket Files. While Previews work just fine, clicking the actual file to view or edit it produces the errors seen in the attache...
