Skip to content

Sergo007/auth0-flutter-web

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Auth0 Flutter Web

A wrapper for Auth0 SPA SDK to use Auth0 in Flutter Web.

⚠ The latest is 0.0.1-alpha.6 but not serve by pub.dev by default.

How to use

1. Add dependency

dependencies:
  auth0_flutter_web:

2. Load Auth0 SPA SDK in index.html

Make Auth0 SPA SDK available for dart by adding it to index.html in web folder (besides ios and android)

<head>
  <!-- other elements in head -->
  <script src="https://cdn.auth0.com/js/auth0-spa-js/1.20/auth0-spa-js.production.js"></script>
  <!-- other elements in head -->
</head>

3. Use Auth0 in dart code

import 'package:auth0_flutter_web/auth0_flutter_web.dart';

Auth0 auth0 = await createAuth0Client(
  Auth0CreateOptions(
    domain: '-- domain of the universal login page --',
    client_id: '-- id of your app --',
  )
);

String token = await auth0.getTokenWithPopup();

Example

Complete source code of working example can be found in example folder under repository root

About

Wrapper of Auth0 SPA SDK for Flutter Web

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 86.3%
  • HTML 13.7%