https://github.com/logto-io/dart
Build authentication and authorization with Logto Flutter SDKs.
https://github.com/logto-io/dart
android authentication authorization dart flutter ios jwt logto mfa multi-tenant oauth2 oidc saml sso
Last synced: 11 days ago
JSON representation
Build authentication and authorization with Logto Flutter SDKs.
- Host: GitHub
- URL: https://github.com/logto-io/dart
- Owner: logto-io
- License: mit
- Created: 2022-08-16T03:15:03.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2025-03-20T10:33:06.000Z (about 1 month ago)
- Last Synced: 2025-03-20T11:33:32.308Z (about 1 month ago)
- Topics: android, authentication, authorization, dart, flutter, ios, jwt, logto, mfa, multi-tenant, oauth2, oidc, saml, sso
- Language: Dart
- Homepage:
- Size: 313 KB
- Stars: 22
- Watchers: 6
- Forks: 15
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
![]()
Logto helps you quickly focus on everything after signing in.# Logto Flutter SDK
[](https://github.com/logto-io/dart/actions/workflows/main.yml)
This project is the official Flutter SDK for [Logto](https://logto.io). It provides a simple way to integrate Logto into your Flutter project.
In the background, this SDK uses the [flutter_web_auth_2](https://pub.dev/packages/flutter_web_auth_2) package to handle the OAuth2 flow.
## Installation
Add the following dependencies to your `pubspec.yaml` file:
```yaml
dependencies:
logto_dart_sdk: ^3.0.0
```Then run `flutter pub get` to install the package.
Or directly install the package by running:
```bash
flutter pub add logto_dart_sdk
```Check out the package on [pub.dev](https://pub.dev/packages/logto_dart_sdk).
## Setup
- iOS: No additional setup required.
- [Android](https://github.com/ThexXTURBOXx/flutter_web_auth_2?tab=readme-ov-file#android).
- [Web](https://github.com/ThexXTURBOXx/flutter_web_auth_2?tab=readme-ov-file#web)Learn more about the [flutter_web_auth_2 setup](https://github.com/ThexXTURBOXx/flutter_web_auth_2?tab=readme-ov-file#setup).
## Usages
### Init Logto SDK
```dart
final logtoConfig = const LogtoConfig(
endpoint: "",
appId: ""
);void _init() {
logtoClient = LogtoClient(
config: logtoConfig,
httpClient: http.Client(), // Optional http client
);
render();
}
```### Sign in and sign out
```dart
// Sign in
await logtoClient.signIn(redirectUri);// Sign out
await logtoClient.signOut(redirectUri);
```### Full SDK documentation
Check [Flutter SDK guide](https://docs.logto.io/quick-starts/flutter) for more details.
## Supported platforms
iOS, Android, Web
## Migration guide
:::note
For SDK version before 3.0.0, this SDK uses the [flutter_web_auth](https://pub.dev/packages/flutter_web_auth) package.
:::1. Upgrade to the latest version
```yaml
dependencies:
logto_dart_sdk: ^3.0.0
```2. Update the manifest files (Android platform only)
Replace the flutter_web_auth callback activity with the new `flutter_web_auth_2` in the AndroidManifest.xml file.
- FlutterWebAuth -> FlutterWebAuth2
- flutter_web_auth -> flutter_web_auth_23. `redirectUri` parameter is now required for the `signOut` method.
```dart
await logtoClient.signOut(redirectUri);
```