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
- Impossible to create project via CLI?
Is it possible to create a new project via the appwrite CLI ? I need to create a few projects for something I'm working on and because i don't want to do it man...
- Understanding S3 setup with appwrite
Hey, i'm planning to change the storage from local to S3, tho i have some questions to see before starting the migration. 1. Does all the `/storage/<storage_ty...
- S3 files like health6a079a79afaa25.44072...
I migrated to another external S3 host for my appwrite and in many (but not all) folders a file (something like health6a079a79afaa25.44072323 - file itself is e...