-
Notifications
You must be signed in to change notification settings - Fork 21
Description
👟 Reproduction steps
When I use this package: dart_appwrite: 16.1.0 in my jaspr project and I try to sign in to create a session the cookies aren't passed. I first tried figuring out if it was some security issue but I got it working by manually sending the requests.
For example when I run this code:
var acc = Account(client);
await acc.createEmailPasswordSession(email: email, password: password);
await acc.getSession(sessionId: 'current');
I get the cookie from my self hosted server:

But the get current session request does not have the cookies attached when sending the request:

👍 Expected behavior
When I send it manually like this:
final response = await html.HttpRequest.request(
url,
method: 'POST',
requestHeaders: {
'Content-Type': 'application/json',
'X-Appwrite-Project': value,
},
sendData: jsonEncode({
'email': email,
'password': password,
}),
withCredentials: true, // <-- this is essential
)
And I request the session again:
final response = await html.HttpRequest.request(
'$endPoint/account/sessions/current',
method: 'GET',
requestHeaders: {
'X-Appwrite-Project': value,
},
withCredentials: true,
)
The cookies are attached correctly:

So I tried to patch this package locally but I couldn't get it to work but I'm almost certain its in this line:
sdk-for-dart/lib/src/client_browser.dart
Line 27 in 16a7403
_httpClient = BrowserClient(); |
Which should be:
_httpClient = BrowserClient()..withCredentials = true;
Maybe I'm wrong but let me know if I am :)
👎 Actual Behavior
Cookies aren't send.
🎲 Appwrite version
Version 0.10.x
💻 Operating system
Linux
🧱 Your Environment
No response
👀 Have you spent some time to check if this issue has been raised before?
- I checked and didn't find similar issue
🏢 Have you read the Code of Conduct?
- I have read the Code of Conduct