This package is a Dart wrapper around the official auth0-spa-js JavaScript package. It enables adding Auth0 authentication to Flutter Web Apps without writing a standalone authentication library in Dart.


  • Authentication with Auth0 using PKCE
  • Securing the app with Refresh Tokens
  • Use the returned access token to access a protected resource (eg. backend server)


  • Add the auth0-spa-js JavaScript file to web/index.html, in the HEAD section.
<!DOCTYPE html>
  <!-- Other head content ... -->

  <script src=""></script>
  <!-- Other body content ... -->
  • Use the package in your app
var auth0client = await Auth0.create(Auth0ClientOptions(
  domain:, // Your domain
  clientId: asdfgh123456, // Your client id
  redirectUri:, // Your redirect URI
  audience: https://example/api, // Your audience
  useRefreshTokens: true, // Use refresh tokens instead of cookie-based validation
  cacheLocation: 'localstorage' // Store the tokens in local storage, default is in-memory

  RedirectLoginOptions(uiLocales: locale ?? languageCode)


Additional information

Feel free to contribute to the package and file bug reports on the official repository.