#[CLOSED] Failed to verify JWT

3 messages · Page 1 of 1 (latest)

tulip plinth
#

I get logged in server side and no problem setting the cookie.

When i try to use it to create a document using REST:

         const response = await fetch(`${AppwriteEndpoint}/databases/${Database.name}/collections/${Collection.test}/documents`, {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                    'X-Appwrite-Response-Format': '1.0.0',
                    'X-Appwrite-Project': AppwriteProject,
                    'X-Appwrite-JWT': jwtVal
                },
                body: JSON.stringify(body)

            });

I get a invalid token as a response. I console logged the token jwtValand it matches what is in the cookie.
not sure what the problem is.

{
  message: 'Failed to verify JWT. Invalid token: Incomplete segments',
  code: 401,
  type: 'user_jwt_invalid',
  version: '1.3.8'
}
proud linden
tulip plinth
#

oh ok.