flutter_auth0 0.5.0

  • Readme
  • Changelog
  • Installing
  • 85

flutter_auth0 plugin #

A Flutter plugin to use the Auth0 API & Auth0 PKCE flow.

Note: This plugin is still under development, and some APIs might not be available yet. Feedback and Pull Requests are most welcome!

Example #

See the example application source for a complete sample app using the auth0 authentication.

What is Auth0? #

Auth0 helps you to:

  • Add authentication with multiple authentication sources, either social like Google, Facebook, Microsoft Account, LinkedIn, GitHub, Twitter, Box, Salesforce, amont others, or enterprise identity systems like Windows Azure AD, Google Apps, Active Directory, ADFS or any SAML Identity Provider.
  • Add authentication through more traditional username/password databases.
  • Add support for linking different user accounts with the same user.
  • Support for generating signed Json Web Tokens to call your APIs and flow the user identity securely.
  • Analytics of how, when and where users are logging in.
  • Pull data from other sources and add it to the user profile, through JavaScript rules.

Create a free Auth0 Account #

  1. Go to Auth0 and click Sign Up.
  2. Use Google, GitHub or Microsoft Account to login.

Author #

Denny Segura dev.dennysegura@gmail.com

This readme based on react-native-auth0

License #

This project is licensed under the MIT license. See the LICENSE file for more info.

v0.5.0 (2019-08-09) #

breaking changes:

  • parameter to use auth0 authentication

features:

  • users handler
    • get user info
    • update user info

v0.3.1 (2019-08-09) #

fixes:

  • pub.dev fixes

v0.3.0 (2019-08-09) #

fixes:

  • blank login page

v0.2.2 (2019-08-08) #

fixes:

  • minor fixes

v0.2.1 (2019-01-31) #

fixes:

  • Expiration token in seconds.

v0.2.0 (2019-01-30) #

enhances:

  • Error handler when sign-in/sign-up.

v0.1.0 (2019-01-10) #

features:

  • Refresh token integrated.

enhances:

  • directory layout was change.

v0.0.2 (2018-12-03) #

Using Authorization Code flow with PKCE #

alt

Callback URL(s) #

Callback URLs are the URLs that Auth0 invokes after the authentication process. Auth0 routes your application back to this URL and appends additional parameters to it, including a token. Since callback URLs can be manipulated, you will need to add this URL to your Application's Allowed Callback URLs for security. This will enable Auth0 to recognize these URLs as valid. If omitted, authentication will not be successful.

Go to the Auth0 Dashboard, select your application and make sure that Allowed Callback URLs contains the following:

iOS #

{YOUR_BUNDLE_IDENTIFIER}://${YOUR_AUTH0_DOMAIN}/ios/{YOUR_BUNDLE_IDENTIFIER}/callback

Android #

{YOUR_APP_PACKAGE_NAME}://{YOUR_AUTH0_DOMAIN}/android/{YOUR_APP_PACKAGE_NAME}/callback

To use #

Android #

In the file android/app/src/main/AndroidManifest.xml you must make sure the MainActivity of the app has a launchMode value of singleTask and add the following activity:

So if you have samples.auth0.com as your Auth0 domain you would have the following MainActivity configuration:

manifes-activity

Create the file RedirectUriReceiver.java

RedirectUriReceiver.java

iOS #

Inside the ios folder find the file AppDelegate.[swift|m] add the following to it

RedirectUriReceiver.java

Inside the ios folder open the Info.plist and locate the value for CFBundleIdentifier, e.g.

<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>

and then register a URL type entry using the value of CFBundleIdentifier as the value of CFBundleURLSchemes

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>None</string>
        <key>CFBundleURLName</key>
        <string>auth0</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
        </array>
    </dict>
</array>

v0.0.1 (2018-10-31) #

A Flutter plugin to use the Auth0 API.

Note: This plugin is still under development, and some APIs might not be available yet. Feedback and Pull Requests are most welcome!

Usage #

To use this plugin, add flutter_auth0 as a dependency in your pubspec.yaml file.

SignIn with email and password #

To signin instance auth0 using auth0-client-id and auth0-domain and call signInWithEmailAndPassword function with email and password as params


final auth = new Auth0(clientId: 'your-client-id', domain: 'your-domain');

Auth0User user = await auth.passwordRealm(
        username: 'username/email',
        password: 'password',
        realm: 'Username-Password-Authentication');

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_auth0: ^0.5.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_auth0/flutter_auth0.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
78
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
82
Overall:
Weighted score of the above. [more]
85
Learn more about scoring.

We analyzed this package on Oct 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-0.24 points)

75 out of 77 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/src/networking/client.dart.

Run flutter format to format lib/src/networking/client.dart.

Format lib/src/networking/telemetry.dart.

Run flutter format to format lib/src/networking/telemetry.dart.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and flutter_auth0.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

The package description is too short. (-8 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
http ^0.12.0+2 0.12.0+2
meta ^1.1.6 1.1.7
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.11 1.14.12
http_parser 3.1.3
path 1.6.4
pedantic 1.8.0+1
sky_engine 0.0.99
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
test ^1.6.5