aad_oauth 0.1.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new73

Azure Active Directory OAuth

A Flutter OAuth package for performing user authentication against Azure Active Directory OAuth2 v2.0 endpoint. Forked from hitherejoe.FlutterOAuth.

Supported Flows:

Usage

For using this library you have to create an azure app at the Azure App registration portal. Use native app as plattform type (with callback URL: https://login.live.com/oauth20_desktop.srf).

Afterwards you have to initialize the library as follow:

final Config config = new Config(
  "YOUR TENANT ID",
  "YOUR CLIENT ID",
  "openid profile offline_access");
final AadOAuth oauth = new AadOAuth(config);

This allows you to pass in an tenant ID, client ID and scope.

Then once you have an OAuth instance, you can call login() and afterwards getAccessToken() to retrieve an access token:

await oauth.login();
String accessToken = await oauth.getAccessToken();

You can also call getAccessToken() directly. It will automatically login and retrive an access token.

Tokens are cached in memory. to destroy the tokens you can call logout():

await oauth.logout();

Installation

Add the following to your pubspec.yaml dependencies:

dependencies:
  aad_oauth: "^0.1.2"

[0.1.2] - 20181229

  • Added example README

[0.1.1] - 20181229

  • Added an example

[0.1.0] - 20181229

  • Adjusted library interface
  • Bug fixing

[0.0.1] - 20181228

  • Initial release

example/README.md

aad-oauth-example

A Flutter OAuth package example for performing user authentication against Azure Active Directory OAuth2 v2.0 endpoint.

Usage

Register an App in the Azure App registration portal. Use native app as plattform type (with callback URL: https://login.live.com/oauth20_desktop.srf).

Add your Azure tenant ID and client ID (ID of App) in the main.dart source-code:

static final Config config = new Config("YOUR_TENANT_ID", "YOUR CLIENT ID", "openid profile offline_access");

Afterwards you can login and get an access token for accessing other resources.

Use this package as a library

1. Depend on it

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


dependencies:
  aad_oauth: ^0.1.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:aad_oauth/aad_oauth.dart';
  
Version Uploaded Documentation Archive
0.1.2 Dec 29, 2018 Go to the documentation of aad_oauth 0.1.2 Download aad_oauth 0.1.2 archive
0.1.1 Dec 29, 2018 Go to the documentation of aad_oauth 0.1.1 Download aad_oauth 0.1.1 archive
0.1.0 Dec 29, 2018 Go to the documentation of aad_oauth 0.1.0 Download aad_oauth 0.1.0 archive
0.0.1 Dec 28, 2018 Go to the documentation of aad_oauth 0.0.1 Download aad_oauth 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
46
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
73
Learn more about scoring.

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

  • Dart: 2.1.0
  • pana: 0.12.10
  • Flutter: 1.1.7

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-1 points)

97 out of 97 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

Format lib/aad_oauth.dart.

Run flutter format to format lib/aad_oauth.dart.

Format lib/helper/auth_storage.dart.

Run flutter format to format lib/helper/auth_storage.dart.

Format lib/model/token.dart.

Run flutter format to format lib/model/token.dart.

Fix additional 5 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/request/authorization_request.dart (Run flutter format to format lib/request/authorization_request.dart.)
  • lib/request/token_refresh_request.dart (Run flutter format to format lib/request/token_refresh_request.dart.)
  • lib/request/token_request.dart (Run flutter format to format lib/request/token_request.dart.)
  • lib/request_code.dart (Run flutter format to format lib/request_code.dart.)
  • lib/request_token.dart (Run flutter format to format lib/request_token.dart.)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
flutter_webview_plugin ^0.3.0+2 0.3.0+2
http ^0.12.0 0.12.0+1
Transitive dependencies
async 2.0.8
charcode 1.1.2
collection 1.14.11
http_parser 3.1.3
meta 1.1.6 1.1.7
path 1.6.2
sky_engine 0.0.99
source_span 1.5.1
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test