Skip to content

Commit 582ad9e

Browse files
authored
Merge pull request #254 from appwrite/dev
fix: devKeys support by conditionally including credentials
2 parents 26b07d9 + 79ad903 commit 582ad9e

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Add this to your package's `pubspec.yaml` file:
2121

2222
```yml
2323
dependencies:
24-
appwrite: ^17.0.0
24+
appwrite: ^17.0.1
2525
```
2626
2727
You can install packages from the command line:

lib/src/client_browser.dart

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ClientBrowser extends ClientBase with ClientMixin {
4040
'x-sdk-name': 'Flutter',
4141
'x-sdk-platform': 'client',
4242
'x-sdk-language': 'flutter',
43-
'x-sdk-version': '17.0.0',
43+
'x-sdk-version': '17.0.1',
4444
'X-Appwrite-Response-Format': '1.7.0',
4545
};
4646

@@ -136,7 +136,6 @@ class ClientBrowser extends ClientBase with ClientMixin {
136136
if (cookieFallback != null) {
137137
addHeader('x-fallback-cookies', cookieFallback);
138138
}
139-
_httpClient.withCredentials = true;
140139
}
141140

142141
@override
@@ -227,11 +226,21 @@ class ClientBrowser extends ClientBase with ClientMixin {
227226
}) async {
228227
await init();
229228

229+
// Combine headers to check for dev key
230+
final combinedHeaders = {..._headers!, ...headers};
231+
232+
// Only include credentials when dev key is not set
233+
if (combinedHeaders['X-Appwrite-Dev-Key'] == null) {
234+
_httpClient.withCredentials = true;
235+
} else {
236+
_httpClient.withCredentials = false;
237+
}
238+
230239
late http.Response res;
231240
http.BaseRequest request = prepareRequest(
232241
method,
233242
uri: Uri.parse(_endPoint + path),
234-
headers: {..._headers!, ...headers},
243+
headers: combinedHeaders,
235244
params: params,
236245
);
237246
try {

lib/src/client_io.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class ClientIO extends ClientBase with ClientMixin {
5858
'x-sdk-name': 'Flutter',
5959
'x-sdk-platform': 'client',
6060
'x-sdk-language': 'flutter',
61-
'x-sdk-version': '17.0.0',
61+
'x-sdk-version': '17.0.1',
6262
'X-Appwrite-Response-Format': '1.7.0',
6363
};
6464

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: appwrite
2-
version: 17.0.0
2+
version: 17.0.1
33
description: Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API
44
homepage: https://appwrite.io
55
repository: https://github.com/appwrite/sdk-for-flutter

0 commit comments

Comments
 (0)