All Projects → LinusU → Flutter_web_auth

LinusU / Flutter_web_auth

Licence: mit
Flutter plugin for authenticating a user with a web service

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Flutter web auth

Fosite
Extensible security first OAuth 2.0 and OpenID Connect SDK for Go.
Stars: ✭ 1,738 (+2045.68%)
Mutual labels:  hacktoberfest, oauth2
Hydra
OpenID Certified™ OpenID Connect and OAuth Provider written in Go - cloud native, security-first, open source API security for your infrastructure. SDKs for any language. Compatible with MITREid.
Stars: ✭ 11,884 (+14571.6%)
Mutual labels:  hacktoberfest, oauth2
Aura.auth
Provides a unified interface to local and remote authentication systems.
Stars: ✭ 121 (+49.38%)
Mutual labels:  hacktoberfest, oauth2
Google Signin
Google Sign-in for your React Native applications
Stars: ✭ 2,391 (+2851.85%)
Mutual labels:  hacktoberfest, oauth2
Pizzly
The simplest, fastest way to integrate your app with an OAuth API 😋
Stars: ✭ 796 (+882.72%)
Mutual labels:  hacktoberfest, oauth2
App
The SimpleLogin back-end
Stars: ✭ 958 (+1082.72%)
Mutual labels:  hacktoberfest, oauth2
Node Oidc Provider
OpenID Certified™ OAuth 2.0 Authorization Server implementation for Node.js
Stars: ✭ 2,018 (+2391.36%)
Mutual labels:  hacktoberfest, oauth2
Product Is
Welcome to the WSO2 Identity Server source code! For info on working with the WSO2 Identity Server repository and contributing code, click the link below.
Stars: ✭ 435 (+437.04%)
Mutual labels:  hacktoberfest, oauth2
Angular Auth Oidc Client
npm package for OpenID Connect, OAuth Code Flow with PKCE, Refresh tokens, Implicit Flow
Stars: ✭ 577 (+612.35%)
Mutual labels:  hacktoberfest, oauth2
Hackathon Starter
A boilerplate for Node.js web applications
Stars: ✭ 32,485 (+40004.94%)
Mutual labels:  hacktoberfest, oauth2
Fosoauthserverbundle
A server side OAuth2 Bundle for Symfony
Stars: ✭ 1,068 (+1218.52%)
Mutual labels:  hacktoberfest, oauth2
Udoit
The Universal Design Online content Inspection Tool, or UDOIT (pronounced, “You Do It”) enables faculty to identify accessibility issues in Canvas by Instructure. It will scan a course, generate a report, and provide resources on how to address common accessibility issues.
Stars: ✭ 80 (-1.23%)
Mutual labels:  hacktoberfest
Mattermost Plugin Gitlab
GitLab plugin for Mattermost
Stars: ✭ 80 (-1.23%)
Mutual labels:  hacktoberfest
Enseada
A Cloud native multi-package registry
Stars: ✭ 80 (-1.23%)
Mutual labels:  oauth2
Pentydesktopassistant
Penty is a small Desktop Assistant programmed with JS and Python as its backend and HTML and CSS as its front. Took just over a month to create v1.0. It has a few features, like an in-built gMail sender and a quick-open browser.
Stars: ✭ 80 (-1.23%)
Mutual labels:  hacktoberfest
Kde
[MIRROR] KDE team's testing overlay
Stars: ✭ 80 (-1.23%)
Mutual labels:  hacktoberfest
Discourse Oauth2 Basic
A basic OAuth2 plugin for use with Discourse
Stars: ✭ 80 (-1.23%)
Mutual labels:  oauth2
Iis
Development repository for the iis cookbook
Stars: ✭ 79 (-2.47%)
Mutual labels:  hacktoberfest
Gentoo Rust
[MIRROR] Rust packages
Stars: ✭ 79 (-2.47%)
Mutual labels:  hacktoberfest
Plots.jl
Powerful convenience for Julia visualizations and data analysis
Stars: ✭ 1,225 (+1412.35%)
Mutual labels:  hacktoberfest

Web Auth for Flutter

A Flutter plugin for authenticating a user with a web service, even if the web service is run by a third party. Most commonly used with OAuth2, but can be used with any web flow that can redirect to a custom scheme.

In the background, this plugin uses ASWebAuthenticationSession on iOS 12+ and macOS 10.15+, SFAuthenticationSession on iOS 11, and Chrome Custom Tabs on Android. You can build it with iOS 8+, but it is currently only supported by iOS 11 or higher.

iOS Android
iOS Android
macOS
macOS

Usage

To authenticate against your own custom site:

import 'package:flutter_web_auth/flutter_web_auth.dart';

// Present the dialog to the user
final result = await FlutterWebAuth.authenticate(url: "https://my-custom-app.com/connect", callbackUrlScheme: "my-custom-app");

// Extract token from resulting url
final token = Uri.parse(result).queryParameters['token']

To authenticate the user using Google's OAuth2:

import 'package:flutter_web_auth/flutter_web_auth.dart';

import 'dart:convert' show jsonDecode;
import 'package:http/http.dart' as http;

// App specific variables
final googleClientId = 'XXXXXXXXXXXX-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com';
final callbackUrlScheme = 'com.googleusercontent.apps.XXXXXXXXXXXX-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';

// Construct the url
final url = Uri.https('accounts.google.com', '/o/oauth2/v2/auth', {
  'response_type': 'code',
  'client_id': googleClientId,
  'redirect_uri': '$callbackUrlScheme:/',
  'scope': 'email',
});

// Present the dialog to the user
final result = await FlutterWebAuth.authenticate(url: url.toString(), callbackUrlScheme: callbackUrlScheme);

// Extract code from resulting url
final code = Uri.parse(result).queryParameters['code'];

// Use this code to get an access token
final response = await http.post('https://www.googleapis.com/oauth2/v4/token', body: {
  'client_id': googleClientId,
  'redirect_uri': '$callbackUrlScheme:/',
  'grant_type': 'authorization_code',
  'code': code,
});

// Get the access token from the response
final accessToken = jsonDecode(response.body)['access_token'] as String;

Setup

Setup works as for any Flutter plugin, expect the Android caveat outlined below:

Android

In order to capture the callback url, the following activity needs to be added to your AndroidManifest.xml. Be sure to relpace YOUR_CALLBACK_URL_SCHEME_HERE with your actual callback url scheme.

<manifest>
  <application>

    <activity android:name="com.linusu.flutter_web_auth.CallbackActivity" >
      <intent-filter android:label="flutter_web_auth">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="YOUR_CALLBACK_URL_SCHEME_HERE" />
      </intent-filter>
    </activity>

  </application>
</manifest>
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].