flutter_token_auth 0.2.1 copy "flutter_token_auth: ^0.2.1" to clipboard
flutter_token_auth: ^0.2.1 copied to clipboard

A package for handling token-based authentication in Flutter.

Implements a basic system for managing token-based authentication. This is designed specifically to interact neatly with https://github.com/lynndylanhurley/devise_token_auth.

Flutter Test Publish to pub.flutter-io.cn

Features #

  • Persisting of user in local storage to avoid re-authentication
  • Validation of token to ensure user is authenticated
  • Login / Logout
  • Test mocking

Getting started #

The first time that AuthManager is instantiated on the app launch it must be instantiated with an AuthConfig. The only required url there is your server's url (eg: app.example.com) provided that the other paths follow the defaults. This is best placed in your main.dart file.

AuthManager(config: AuthConfig(appUrl: "app.example.com"));

Usage #

AuthManager.login('user@example.com', 'password'); // login a user
AuthManager.currentUser; // get the current user
await AuthManager.loadFromStorage(); // on app load, retreive the cached local user

There are additional settings to be passed in in AuthConfig, see the interface in https://github.com/diarmuidr3d/flutter_token_auth/blob/main/lib/src/auth_config.dart for example

Additional information #

TODO

2
likes
0
points
158
downloads

Publisher

verified publisherfeirmapp.ie

Weekly Downloads

A package for handling token-based authentication in Flutter.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_secure_storage, http

More

Packages that depend on flutter_token_auth