This sample app demonstrates the integration of the Auth0 Flutter SDK into a Flutter app. The sample is a companion to the Auth0 Flutter Quickstart.
- Flutter 3+
- Xcode 14.x / 15.x (for iOS/macOS)
- Android Studio 4+ (for Android)
Go to the settings page of your Auth0 application and add the corresponding URL to Allowed Callback URLs and Allowed Logout URLs, according to the app target you want to run. If you are using a custom domain, replace YOUR_AUTH0_DOMAIN with the value of your custom domain instead of the value from the settings page.
Android
SCHEME://YOUR_AUTH0_DOMAIN/android/YOUR_PACKAGE_NAME/callback
iOS
YOUR_BUNDLE_ID://YOUR_AUTH0_DOMAIN/ios/YOUR_BUNDLE_ID/callback
macOS
YOUR_BUNDLE_ID://YOUR_AUTH0_DOMAIN/macos/YOUR_BUNDLE_ID/callback
Go to the settings page of your Auth0 application and configure the following URLs:
- Allowed Callback URLs:
http://localhost:3000 - Allowed Logout URLs:
http://localhost:3000 - Allowed Web Origins:
http://localhost:3000
The sample app uses flutter_dotenv for its configuration. Rename .env.example to .env and provide the appropriate domain and Client Id. Optionally, when using Android, you can configure the scheme as well. This can be set to a custom scheme, or https if you want to use Android App Links. You can read more about setting this value in the Auth0.Android SDK README.
AUTH0_DOMAIN=dev-t1qeokemoah3ctwm.us.auth0.com
AUTH0_CLIENT_ID={yourClientId}
# AUTH0_CUSTOM_SCHEME=SCHEMEIn the sample, we are using values referenced from android/app/src/main/res/values/strings.xml. Rename strings.xml.example to strings.xml and fill in the respective values.
com_auth0_domain: The domain of your Auth0 tenant. Generally, you can find this in the Auth0 Dashboard under your application's settings in the Domain field. If you are using a custom domain, you should set this to the value of your custom domain instead.com_auth0_scheme: The scheme to use. Can be a custom scheme, orhttpsif you want to use Android App Links. You can read more about setting this value in the Auth0.Android SDK README.
The sample has already configured the required Url Types to ensure the callback and logout URLs can reach the app, so there is nothing to configure to run the sample on iOS and macOS.
To run the project, use the Flutter CLI's run command.
flutter runEnsure you have at least one emulator running. If you have multiple running, the CLI will prompt you to select the one to run the app on.
flutter run -d chrome --web-port 3000 --web-renderer htmlTo compile the project, use the Flutter CLI's build command, including the platform you want to target.
flutter build apk
flutter build ios
flutter build macos
flutter build webFor general support or usage questions, use the Auth0 Community forums or raise a support ticket. Only raise an issue if you have found a bug or want to request a feature.
Do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.
Auth0 helps you to:
- Add authentication with multiple sources, either social identity providers such as Google, Facebook, Microsoft Account, LinkedIn, GitHub, Twitter, Box, Salesforce (amongst others), or enterprise identity systems like Windows Azure AD, Google Apps, Active Directory, ADFS, or any SAML identity provider.
- Add authentication through more traditional username/password databases.
- Add support for linking different user accounts with the same user.
- Support for generating signed JSON Web Tokens to call your APIs and flow the user identity securely.
- Analytics of how, when, and where users are logging in.
- Pull data from other sources and add it to the user profile through JavaScript Actions.
Why Auth0? Because you should save time, be happy, and focus on what really matters: building your product.
This project is licensed under Apache License 2.0. See the LICENSE file for more information.