• Stars
    star
    173
  • Rank 220,124 (Top 5 %)
  • Language
    Dart
  • License
    Other
  • Created almost 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Flutter OAuth package for performing user authentication for your apps.

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. For 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));

Then once you have an OAuth instance, you can simply call the performAuthorization() method like so to retrieve a Token instance:

Token token = await flutterOAuth.performAuthorization();
String accessToken = token.accessToken;

Installing

Add the following you your pubspec.yaml dependancies:

dependencies:
  flutter_oauth: "^0.0.1"

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 author, Hadrien Lejard, behind the:

The Gitter-Dart repo, where a lot of this library was influenced

and the Flutter Webview plugin, which this library uses

More Repositories

1

animate

An application demoing meaningful motion on Android
Java
3,117
star
2

Android-Boilerplate

Android Boilerplate project using RxJava, Dagger 2, Espresso, Mockito + more!
Java
1,871
star
3

Bourbon

An MVP Dribbble client for Android Mobile, Tablet, Wear and TV.
Java
1,119
star
4

MVVM_Hacker_News

Android MVVM experiment project using the official Data Binding library
Java
881
star
5

ComposeAcademy-Playground

Playground project for the Jetpack Compose APIs
Kotlin
868
star
6

Vineyard

Vine client for Android TV
Java
725
star
7

minimise

Minimise app built using kotlin multiplatform
Kotlin
427
star
8

Tabby

A demo application for the new Android Custom Tabs support library
Java
414
star
9

Constraints

Sample application for the new Android ConstraintLayout
Java
326
star
10

LeanbackCards

Extended set of content cards for Android TV applications.
Java
294
star
11

Notifi

A demo app for the new Android N notification features
Java
199
star
12

AndroidTvBoilerplate

Android TV Boilerplate Project
Java
185
star
13

ComposeAcademy

Website providing snippets and examples for Jetpack Compose on the Android platform
SCSS
181
star
14

GithubTrending

An Android project for the Caster.io course on clean architecture
Kotlin
175
star
15

WatchTower

A sample application created to test, explore and demonstrate the Proximity Beacon API
Java
144
star
16

Mondroid

A simple Mondo client for Android
Java
134
star
17

BottomNavigationViewSample

A sample app for the new Bottom Navigation View from the Design Support library
Java
134
star
18

HackerNewsReader

Modern Hacker News reader with a Material Design look!
Java
113
star
19

Aware

A playground for the new Google Awareness API
Java
99
star
20

PublicSpeaking

A collection of my abstracts and other stuff related to public speaking
86
star
21

Pickr

A sample application demoing the Google Play Services Place Picker and Autocomplete
Java
85
star
22

Voice

A simple Flutter project demonstrating tailored native experiences
Dart
69
star
23

Android-Q-Playground

A playground for new Android Q features
Kotlin
54
star
24

MvpBoilerplate

An MVP Boilerplate to save me having to create the same project over from scratch every time! :)
Java
46
star
25

Tide

Unsplash client built using Flutter
Dart
36
star
26

KoinDemo

A demo app for the Koin Caster.io course
Kotlin
35
star
27

BrailleBox

A BrailleNews reader built with AndroidThings
Java
26
star
28

PictureInPicturePlayground

A playground for the new Android N Picture-in-Picture mode
Java
25
star
29

adoptr

Jetpack Compose Android Dev Challenge
Kotlin
21
star
30

ChordAssist

Kotlin
20
star
31

FootballFace

Android Wear watch faces for your favourite American Football team
Java
17
star
32

Compose-Navigation-Sample

Quick sample based on Compose + Navigation component
Kotlin
16
star
33

Hilt_Course

Code for the Hilt Course on Caster.io
Kotlin
13
star
34

Fret

A guitar chord tutor for google actions
JavaScript
13
star
35

HashTrack-Public

A flutter application to track hashtags for Twitter and Instagram
Dart
11
star
36

Attendee-Android

A conference app for Android built using Firebase
Kotlin
8
star
37

ComposeTv

Kotlin
7
star
38

Resources-for-Allyship

A personal list of article, books etc that I have read / watched which have helped me learn more around diversity and inclusion
6
star
39

flutter-bitrise

Dart
6
star
40

firebase_auth_multiplatform

Kotlin
5
star
41

sqlbrite_demo

A simple demo application for the SqlLite library by Square
Java
5
star
42

Fireside

Sample project for Firebase Remote Config Caster.IO lesson
Java
5
star
43

Androidx_webview_sample

Kotlin
3
star
44

Reactemon

A React-Native Pokedex for Android/iOS
JavaScript
3
star
45

Bastion

Kotlin
2
star
46

Hashtrack-ios

Hashtag tracker for iOS
Swift
1
star