Back

appwrite and FlutterFlow integration - REST API

  • 0
  • Cloud
  • REST API
gelmuda
21 Jan, 2024, 19:26

Hi, I try to integrate appwrite (cloud) with Flutter Flow via REST API calls. I can log in (start an email session) and I am getting "x-fallback-cookies" in return in a header. Next I try to use the "X-Fallback-Cookies": "a_session_65...ac=ey...J9" to get user name via https://cloud.appwrite.io/v1/account but I am getting:

{ "message": "User (role: guests) missing scope (account)", "code": 401, "type": "general_unauthorized_scope", "version": "0.12.45" }

With Postman and the same data, same headers I am getting the right response (also with "Cookies" key instead of "X-Fallback-Cookies"). What am I doing wrong?

TL;DR
Title: Appwrite and FlutterFlow Integration - Issue with REST API Authorization Developers are experiencing issues with integrating Appwrite and FlutterFlow through REST API calls. They are able to successfully log in and obtain a session cookie, but when using this cookie to retrieve user information via a GET request to the Appwrite API, they receive a 401 Unauthorized error with the message "User (role: guests) missing scope (account)". They have compared the headers and request data used in FlutterFlow and Postman, and everything appears to be identical. However, the response is correct in Postman while it fails in FlutterFlow. A
gelmuda
21 Jan, 2024, 19:27

appwrite and FlutterFlow integration - REST API

Drake
21 Jan, 2024, 19:31

Did you include the project header?

gelmuda
21 Jan, 2024, 19:42

@steven, yes.

Drake
21 Jan, 2024, 19:44

Are you able to inspect the network requests?

gelmuda
21 Jan, 2024, 19:47

@Drake I can check these:

gelmuda
21 Jan, 2024, 19:50

When I do the same from Postman, I am getting correct JSON and 200 OK from GET request.

Drake
21 Jan, 2024, 19:51

Is the request being sent via the browser or proxied through flutterflow?

Drake
21 Jan, 2024, 19:51

Is it the exact same cookie value in postman?

gelmuda
21 Jan, 2024, 19:52

From flutter flow. Yes, I use the same cookie value in Postman (copy / paste).

gelmuda
21 Jan, 2024, 19:55

One from US (FlutterFlow), one from PL (Postman) - both were started for testing. Later I tried using both cookies sessions in both FF and Postman, just to see if something would work. In Postman all of them work, in FF none of them.

Drake
21 Jan, 2024, 19:56

I wonder if flutterflow is tweaking the request somehow 🧐

Drake
21 Jan, 2024, 19:57

Chrome? Uhh so is it not proxied? Can you see the request if you open the network inspector in the browser dev tools?

gelmuda
21 Jan, 2024, 19:58

LEt me check.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more