8000 fix: devKeys support by conditionally including credentials by ChiragAgg5k · Pull Request #254 · appwrite/sdk-for-flutter · GitHub
[go: up one dir, main page]

Skip to content

fix: devKeys support by conditionally including credentials #254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Add this to your package's `pubspec.yaml` file:

```yml
dependencies:
appwrite: ^17.0.0
appwrite: ^17.0.1
```

You can install packages from the command line:
Expand Down
15 changes: 12 additions & 3 deletions lib/src/client_browser.dart
8000
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ClientBrowser extends ClientBase with ClientMixin {
'x-sdk-name': 'Flutter',
'x-sdk-platform': 'client',
'x-sdk-language': 'flutter',
'x-sdk-version': '17.0.0',
'x-sdk-version': '17.0.1',
'X-Appwrite-Response-Format': '1.7.0',
};

Expand Down Expand Up @@ -136,7 +136,6 @@ class ClientBrowser extends ClientBase with ClientMixin {
if (cookieFallback != null) {
addHeader('x-fallback-cookies', cookieFallback);
}
_httpClient.withCredentials = true;
}

@override
Expand Down Expand Up @@ -227,11 +226,21 @@ class ClientBrowser extends ClientBase with ClientMixin {
}) async {
await init();

// Combine headers to check for dev key
final combinedHeaders = {..._headers!, ...headers};

// Only include credentials when dev key is not set
if (combinedHeaders['X-Appwrite-Dev-Key'] == null) {
_httpClient.withCredentials = true;
} else {
_httpClient.withCredentials = false;
}

late http.Response res;
http.BaseRequest request = prepareRequest(
method,
uri: Uri.parse(_endPoint + path),
headers: {..._headers!, ...headers},
headers: combinedHeaders,
params: params,
);
try {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/client_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ClientIO extends ClientBase with ClientMixin {
'x-sdk-name': 'Flutter',
'x-sdk-platform': 'client',
'x-sdk-language': 'flutter',
'x-sdk-version': '17.0.0',
'x-sdk-version': '17.0.1',
'X-Appwrite-Response-Format': '1.7.0',
};

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: appwrite
version: 17.0.0
version: 17.0.1
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
homepage: https://appwrite.io
repository: https://github.com/appwrite/sdk-for-flutter
Expand Down
0