user_auth 1.2.0 copy "user_auth: ^1.2.0" to clipboard
user_auth: ^1.2.0 copied to clipboard

discontinued
outdated

Dart - Backend user auth helpe, with common methods

user_auth #

Dart - Backend user auth helpe, with common methods

Pub Example

Show some ❤️ and star the repo #

Fork Star Watch

usage #

  • import package:user_auth/user_auth.dart.
  • create instance from UserAuth.
  • init with apiBaseUrl and optional store: true | false, default is false, if true plugin will store user and retrieve with loadUser().

methods #

you may change routes to fit your API
  • login : default route /user/login, waits for user in response to return.
  • check : default route /user/details, waits for user in response to return.
  • logout : default route /user/details, return true | false.
  • loadUser : local method, return user if stored.
  • Newregister : default route /user/register, waits for user in response to return.

example #

import 'package:user_auth/user_auth.dart';

// instance
UserAuth user = new UserAuth();

// init
await user.init(
    apiBaseUrl: 'https://example.com/api',
    store: true,
  );

// Note : change 'Bearer ' and api_token with your own parameters

// login
var activeUser = loadedUser = await user.login(
                    usernameVar: 'email',
                    usernameVal: 'test@test.com',
                    password: '12345678',
                  );

// check
var checkedUser = await user.check(
                    type: 'Bearer ',
                    token: activeUser['api_token'],
                  ); 

// logout
var logout = await user.logout(
                    type: 'Bearer ',
                    token: activeUser['api_token'],
                  );

// register
Map form = {
            "email" : "test@test.com",
            "phone" : "00000000",
            "name" : "mohamed sayed",
            "password" : "1234567",
            };
registeredUser = await user.register(form: form);

Project Created & Maintained By #

Mohamed Sayed #

Software Engineer | In ❤️ with Flutter

Donate #

If you found this project helpful or you learned something from the source code and want to thank me, consider buying me a cup of ☕

Note : All Contibutions Are Welcomed #

16
likes
0
pub points
0%
popularity

Publisher

verified publishermsayed.net

Dart - Backend user auth helpe, with common methods

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, http, shared_preferences

More

Packages that depend on user_auth