flutter_liferay_oauth 0.1.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 73

Flutter Liferay OAuth 2.0 #

A Flutter OAuth package for performing Liferay login using OAuth2 standard to access Liferay DXP JAX-RS service. Forked from Earlybyte.aad_oauth.

Supported Flows:

More info on Liferay/Oauth2

Usage #

Create a Liferay JAX-RS service and configure OAUTH 2.0 by following these instructions

In the flutter app, initialize:

final Config config = new Config(
  usePkce: true); // Request an authorization code using PKCE code challenge.
final LiferayOAuth oauth = new LiferayOAuth(config);

This allows you to pass in an Liferay Server, Redirect Url, client ID, Client secret and few more optional params.

If your service require to pass an oauth2 scope, the config allows for an optional param 'scope'. For more on OAuth2 Scopes

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

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

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

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

Installation #

Add the following to your pubspec.yaml dependencies:

  flutter_liferay_oauth: "^0.1.3"

[0.0.1] - 20190131

  • Initial release


myblogs Secure #

A secure Flutter application powered Liferay DXP.

Getting Started #

This is an example application secured by Liferay login using OAuth2 standard.

It uses flutter_liferay_oauth flutter package created by Xtivia Developers to simplify the login needs.

OAuth 2.0 is an industry-standard authorization protocol. Users can seamlessly share select credentials from another website/Mobile App to log into yours. It works by authorizing password-less access to portions of user-owned resources (such as an email address, a user profile picture, or something else from your account) and other permissioned resources.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

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

  flutter_liferay_oauth: ^0.1.3

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_liferay_oauth/flutter_liferay_oauth.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

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

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5

Health issues and suggestions

Document public APIs. (-1 points)

102 out of 102 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/flutter_liferay_oauth.dart.

Run flutter format to format lib/flutter_liferay_oauth.dart.

Format lib/model/config.dart.

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

Format lib/request/authorization_request.dart.

Run flutter format to format lib/request/authorization_request.dart.

Fix additional 3 files with analysis or formatting issues.

Additional issues in the following files:

  • 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_token.dart (Run flutter format to format lib/request_token.dart.)


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
crypto ^2.0.6 2.1.4
flutter 0.0.0
flutter_webview_plugin ^0.3.0+2 0.3.10+1
http ^0.12.0 0.12.0+4
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.11 1.14.12
convert 2.1.1
http_parser 3.1.3
meta 1.1.8
path 1.6.4
pedantic 1.9.0
sky_engine 0.0.99
source_span 1.6.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies