Skip to content

chore: (breaking) update flutter_web_auth_2 docs to match 4.x #253

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
May 26, 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
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Change Log

## 16.0.1
## 17.0.0

* Update `flutter_web_auth_2` dependency to version 4.1.0
* Update `auth.html` example in README.md to align with `flutter_web_auth_2` documentation
* Breaking changes:
* Minimum iOS version supported is now 17.4 due to the updated requirements of `flutter_web_auth_2` version 4.1.0

## 16.1.0

* Add `setDevKey` method to Client service
* Add `upsertDocument` method to Databases service
Expand Down
26 changes: 19 additions & 7 deletions 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: ^16.1.0
appwrite: ^17.0.0
```

You can install packages from the command line:
Expand Down Expand Up @@ -89,13 +89,25 @@ For web in order to capture the OAuth2 callback URL and send it to the applicati
```html
<!DOCTYPE html>
<title>Authentication complete</title>
<p>Authentication is complete. If this does not happen automatically, please
close the window.
<p>Authentication is complete. If this does not happen automatically, please close the window.</p>
<script>
window.opener.postMessage({
'flutter-web-auth-2': window.location.href
}, window.location.origin);
window.close();
function postAuthenticationMessage() {
const message = {
'flutter-web-auth-2': window.location.href
};

if (window.opener) {
window.opener.postMessage(message, window.location.origin);
window.close();
} else if (window.parent && window.parent !== window) {
window.parent.postMessage(message, window.location.origin);
} else {
localStorage.setItem('flutter-web-auth-2', window.location.href);
window.close();
}
}

postAuthenticationMessage();
</script>
```

Expand Down
3 changes: 2 additions & 1 deletion lib/src/client_browser.dart
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': '16.1.0',
'x-sdk-version': '17.0.0',
'X-Appwrite-Response-Format': '1.7.0',
};

Expand Down Expand Up @@ -260,6 +260,7 @@ class ClientBrowser extends ClientBase with ClientMixin {
return FlutterWebAuth2.authenticate(
url: url.toString(),
callbackUrlScheme: "appwrite-callback-" + config['project']!,
options: const FlutterWebAuth2Options(useWebview: false),
);
}
}
7 changes: 5 additions & 2 deletions 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': '16.1.0',
'x-sdk-version': '17.0.0',
'X-Appwrite-Response-Format': '1.7.0',
};

Expand Down Expand Up @@ -359,7 +359,10 @@ class ClientIO extends ClientBase with ClientMixin {
callbackUrlScheme: callbackUrlScheme != null && _customSchemeAllowed
? callbackUrlScheme
: "appwrite-callback-" + config['project']!,
options: const FlutterWebAuth2Options(intentFlags: ephemeralIntentFlags),
options: const FlutterWebAuth2Options(
intentFlags: ephemeralIntentFlags,
useWebview: false,
),
).then((value) async {
Uri url = Uri.parse(value);
final key = url.queryParameters['key'];
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: appwrite
version: 16.1.0
version: 17.0.0
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 All @@ -20,7 +20,7 @@ dependencies:
sdk: flutter
cookie_jar: ^4.0.8
device_info_plus: ^10.1.2
flutter_web_auth_2: ^3.1.2
flutter_web_auth_2: ^4.1.0
http: '>=0.13.6 <2.0.0'
package_info_plus: ^8.0.2
path_provider: ^2.1.4
Expand Down