flutter_oauth 0.0.1

  • README.md
  • Installing
  • Versions
  • 90

Flutter OAuth

A flutter oauth package for performing user authentication for your apps.

I've tested this with a small collection of APIs (Buffer, Strava, Unsplash and Github). If there is an issue with an API you are trying to work with, please file an issue :)

Authorizing an application

Performing authorization for an API is straight forward using this library. In most cases you will just be able to use the following approach:

final OAuth flutterOAuth = new FlutterOAuth(new Config( "https://unsplash.com/oauth/authorize", "https://unsplash.com/oauth/token", "YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET", "http://localhost:8080", "code"));

This allows you to pass in an Authorization URL, Token request URL, Client ID, Client Secret, Redirect URL and the response type. This should satisfy most requests, but if not then you can pass in other optional parameters for:

contentType - This allows you to change the content type for the request. Fr example, for Spotify API authorization you need to use "application/x-www-form-urlencoded"

final OAuth flutterOAuth = new FlutterOAuth(new Config( ..., contentType: "application/x-www-form-urlencoded"));

parameters - Add your own parameters that this library may not support out-of-the-box. For example, with the github API you can send a state string and scopes to gain authorization for

Map<String, String> customParameters = {"state": "SOME_RANDOM_SECURE_STRING", "scope": "public_repo"};

final OAuth flutterOAuth = new FlutterOAuth(new Config( ..., parameters: customParameters));

headers - Some APIs require you to send custom headers, such as an Authorization Header. Use this parameter if you require this

Map<String, String> headers = {"Authorization": "Basic SOME_BASE_64_STRING"};

final OAuth flutterOAuth = new FlutterOAuth(new Config( ..., headers: headers));

Token token = await gitterOAuth.signIn(); String accessToken = token.accessToken;

Thanks to

Kevin Seqaud for his awesome blog post on Flutter OAuth https://medium.com/@segaud.kevin/facebook-oauth-login-flow-with-flutter-9adb717c9f2e

THe auther, Hadrien Lejard, behind the:

The Gitter-Dart repo, where a lot of this library was influenced from https://github.com/dart-flitter/gitter_dart

and the Flutter Webview plugin which this library uses https://github.com/dart-flitter/flutter_webview_plugin

[0.0.1] - TODO: Add release date.

  • TODO: Describe initial release.

Use this package as a library

1. Depend on it

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

  flutter_oauth: "^0.0.1"

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:flutter_oauth/lib/auth_code_information.dart';

      import 'package:flutter_oauth/lib/flutter_auth.dart';

      import 'package:flutter_oauth/lib/model/config.dart';

      import 'package:flutter_oauth/lib/oauth.dart';

      import 'package:flutter_oauth/lib/oauth_token.dart';

      import 'package:flutter_oauth/lib/token.dart';
Version Uploaded Documentation Archive
0.0.1 Dec 8, 2017 Go to the documentation of flutter_oauth 0.0.1 Download flutter_oauth 0.0.1 archive


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

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3
  • Flutter: 0.5.4


Describes how popular the package is relative to other packages. [more]
83 / 100
Code health derived from static analysis. [more]
95 / 100
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.


  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 9 hints.

    Run flutter format to format lib/lib/auth_code_information.dart.

    Run flutter format to format lib/lib/flutter_auth.dart.

    Similar analysis of the following files failed:

    • lib/lib/model/config.dart (hint)
    • lib/lib/oauth.dart (hint)
    • lib/lib/oauth_token.dart (hint)
    • lib/lib/token.dart (hint)
  • Maintain an example.

    None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use flutter_oauth.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0
flutter 0.0.0
flutter_webview_plugin >=0.0.5 <0.1.0 0.0.9+1 0.1.6
http ^0.11.3+13 0.11.3+16
Transitive dependencies
async 2.0.7
charcode 1.1.1
collection 1.14.6 1.14.10
http_parser 3.1.2
meta 1.1.5
path 1.6.0 1.6.1
sky_engine 0.0.99
source_span 1.4.0
string_scanner 1.0.2
typed_data 1.1.5
vector_math 2.0.6 2.0.7
Dev dependencies
test ^0.12.0