THE-EOriginal post
Rank 2: Process
Since I have updated to the latest appwrite Flutter package (28.1.0) I am unable to retrieve files using the file ID:
Dart
await getJwt(); //makes sure a valid JWT is used appwrite.Client client = appwrite.Client(); appwrite.Storage storage = appwrite.Storage(client);... client.setEndpoint(endpoint).setProject(projectId).setJWT(_currentJwt!.jwt);I keep getting the following error:
Bash
AppwriteException (AppwriteException: user_jwt_and_cookie_set, JWT and cookie used in the same request. Use either `setJWT` or `setCookie`. Learn about which authentication method to use in the SSR docs: https://appwrite.io/docs/products/auth/server-side-rendering (403))The error is somehow misleading I guess, because I am using only setJWT and not setCookie.
The exception contains the following information:
JSON
{"message":"JWT and cookie used in the same request. Use either `setJWT` or `setCookie`. Learn about which authentication method to use in the SSR docs: https:\/\/appwrite.io\/docs\/products\/auth\/server-side-rendering","code":403,"type":"user_jwt_and_cookie_set","version":"2.5.0"}The headers of the request:
JSON
[Appwrite Headers] {content-type: application/json, x-sdk-name: Flutter, x-sdk-platform: client, x-sdk-language: flutter, x-sdk-version: 28.1.0, X-Appwrite-Response-Format: 2.5.0, X-Appwrite-JWT: [REDACTED], Origin: appwrite-android://com.example.app, user-agent: com.example.app/2.0.1 (Linux; U; Android 17; google Pixel)}I am unsure whether it is a bug or if the setup of the client has changes. Can someone give me a hint?
Summary
The user is encountering an error when trying to retrieve files using JWT authentication in the latest Appwrite Flutter package (28.1.0). They receive a message indicating that both JWT and cookie authentication are being used in the same request, even though they believe they are only using `setJWT`.
The solution suggested in the thread involves ensuring that no cookies are being set or used during the request. The user should double-check their code and any previous configurations to confirm that they are not inadvertently setting a cookie alongside the JWT. Also, reviewing the Appwrite documentation related to authentication methods could help clarify the setup.