A Flutter package to easily integrate Auth0 into Web Flutter apps.
Platform Support
Android | iOS | MacOS | Web | Linux | Windows |
---|---|---|---|---|---|
x | x | x | ✔️ | x | x |
Auth0FlutterWeb is supported for web only.
Features
Integrate Auth0 authentication across web Flutter apps. Registration and Login users, logout users, and identify currently authenticated users across web.
Usage
To use this plugin, add auth0_flutter2
as a dependency in your pubspec.yaml file.
Web
Add the Auth0 Javascript SPA (Single Page Application) library.
<script src="https://cdn.auth0.com/js/auth0-spa-js/1.13/auth0-spa-js.production.js"></script>
Example
Import the library.
import 'package:auth0_flutter2/auth0_flutter2.dart';
Then initialize the Auth0FlutterWeb
class in your main()
method.
void main() {
// add the auth0domain
Auth0FlutterWeb.auth0Domain = "AUTH0_DOMAIN";
//add the auth0ClientID
Auth0FlutterWeb.auth0ClientId = "AUTH0_CLIENT_ID";
// add the redirect uri
Auth0FlutterWeb.redirectUri = "YOUR_APP_REDIRECT_URI";
// Set the URL strategy for our web app. Removes
// trailing hash(#) to ensure login callbacks
// will be captured and processed correctly.
Auth0FlutterWeb.setPathUrlStrategy();
runApp(const MyApp());
}
Then invoke the class methods anywhere in your Dart code.
Auth0FlutterWeb.instance.userAuthentication(screenHint: "signup");
Auth0FlutterWeb.instance.userAuthentication(screenHint: "login");
Auth0FlutterWeb.instance.logoutUser();
Auth0FlutterWeb.instance.getLoggedInUserId();
Libraries
- auth0/auth0
- auth0/auth0_flutter_web/auth0_flutter_web
- auth0/auth0_flutter_web/src/auth0_js_interop
- auth0/auth0_flutter_web/src/js_stubs
- auth0/auth0_flutter_web/src/options
- auth0/auth0_flutter_web/src/promise_to_future_as_map_stub
- auth0/get_logged_in_user/get_logged_in_user
- auth0/get_logged_in_user/get_logged_in_user_stub
- auth0/get_logged_in_user/get_logged_in_user_web
- auth0/handle_redirect_callback/handle_redirect_callback
- auth0/handle_redirect_callback/handle_redirect_callback_stub
- auth0/handle_redirect_callback/handle_redirect_callback_web
- auth0/init_auth0/init_auth0_web
- auth0/login_user/login_user
- auth0/login_user/login_user_stub
- auth0/login_user/login_user_web
- auth0/logout_user/logout_user
- auth0/logout_user/logout_user_stub
- auth0/logout_user/logout_user_web
- auth0_flutter_web