developers

Introducing the Auth0 Flutter SDK

Learn about the essential features of the Auth0 Flutter SDK and how it helps developers build and secure Flutter iOS and Android applications.

Today we are announcing the release of the Auth0 Flutter SDK, a new SDK that makes it easy to secure Flutter applications with Auth0. Whether you need to secure access to an iOS or Android application, the Auth0 Flutter SDK got you covered!

The new Flutter SDK builds on a strong foundation by wrapping our existing and robust Auth0.Android and Auth0.swift libraries while focusing on the developer experience first.

Our SDK team optimized the Auth0 Flutter SDK for quick integration into your applications and for flexibility to accommodate simple and advanced use cases.

Since the introduction of Flutter 3, the framework allows for building cross-platform applications, extending from mobile applications to desktop applications and platforms. Our SDK allows for extension in such platforms by leveraging federated plugins, which means you can easily add support for other platforms without forking the SDK.

Auth0 Flutter SDK Features

The new SDK offers features for multiple use-cases and complexity, going from magically getting the job done to providing a rich set of APIs enabling you to build your authentication flow per your specific requirements.

Let's explore the essential features of the Auth0 Flutter SDK that enable developers to do more:

  • ⚡️ Quick implementation of login, logout, and automatic storage and renewal of tokens functionality into Flutter apps using WebAuth and the Auth0 Universal Login page.
  • ⚙️ For more advanced use-cases, developers have access to the Authentication API, which at the time of release supports:
    • Logging in with a username or email and password
    • Signing up new users
    • Getting user information from
      /userinfo
    • Renew tokens
    • Reset passwords
  • 🔐 Auth0 provides a default instance of Credentials Manager that automatically stores the user's credentials. If you need your own solution for handling credentials, you can create your own custom credentials manager.
  • ➕ And more advanced features like accepting user invites, login into organizations, and bot detection.

Requirements

The Auth0 Flutter SDK doesn't require any other library to work. However, there are SDK version and platform requirements for your project:

FlutterAndroidiOS
SDK 3.0+Android API 21+iOS 12+
Dart 2.17+Java 8+Swift 5.3+
Xcode 13.x / 14.x

Check the project on GitHub to for the most up-to-date set of requirements.

Installing the SDK

The Auth0 Flutter SDK is distributed via pub.dev.

To add the SDK, run the following command from the root directory of your project:

flutter pub get auth0_flutter

Adding Universal Login to Your Flutter Application

Adding the full-featured Auth0 Universal Login authentication page to your application is easy with the SDK.

Please explore the Flutter Quickstart guide to see in detail how to set up your Flutter application to use the Auth0 SDK. For now, let's take a quick peak at how the Flutter SDK integration goes!

Add login to your app

Integrate Auth0 Universal Login in your Flutter app by using the Auth0 class. Redirect your users to the Auth0 Universal Login page using

webAuthentication().login()
. This is a
Future
and must be awaited for you to retrieve the user's tokens.

await auth0.webAuthentication(scheme: 'YOUR CUSTOM SCHEME').login();

Add logout to your app

Logging out users is as easy as calling the Auth0 Flutter SDK

webAuthentication().logout()
function. The
logout()
function is responsible for calling the
logout
endpoint to clear their login session and to clear the user login state from the device session.

await auth0.webAuthentication(scheme: 'YOUR CUSTOM SCHEME').logout();

Next Steps

There are a lot of options to work with with the SDK, and in this post, we only barely scratch the surface of it. If you want to learn more about the SDK, please check out the quick start guide and the SDK documentation.

Thanks for reading!