/flutter_login_types

Create a different ways to login using Flutter Riverpod as state management and dependency injection.

Primary LanguageDartGNU General Public License v3.0GPL-3.0

Flutter · Login Types

Create a different ways to login using Flutter Riverpod as state management and dependency injection.


Flutter

  • Clone this project.
  • If you want to rename the bundles for each platform, you must do the steps below.
    • For Android, you must rename the bundle id on app/build.gradle.
    • For iOS in XCode IDE, you select Runner and change the 'Bundle Identifier' text.
  • You must follow the instructions for setting each third login in the steps follow this link.
  • Run project and enjoy 😄

Types of Login

User / Password

This scenario recreates of type of conventional login (User / Password) like if you try to connect to a backend or database with the user information and validate if the user and password are corrects.

Passcode

This scenario recreates a login type with a phone number and receives a push notification with the access code which is a number with 4 digits.

Fingerprint / Face Id

This scenario recreates the local auth login with the use of fingerprint (Android, iOS) or face id (iOS).

Third sign in

This scenario recreates the authentication with third providers like Facebook, Google, Apple and Twitter.

Other mechanism

This scenario recreates the authentication using different mechanism like Azure Active Directory B2C and/or Auth0, enabling user/password, third logins, etc.


Setting Third logins

Setting Google sign in

  • If you want to set the GoogleServices files follow this link
  • If not, you must set the Google client id on the Info.plist file. Also, set the Dart Define command setting the additional run arguments below
    --dart-define GOOGLE_CLIENT_ID=<YOUR_GOOGLE_CLIENT_ID>
    

These values you must get on the Google Console.

Setting Apple sign in

  • You must set the Apple client id and the redirect url as the Dart Define command setting the additional run arguments below
    --dart-define APPLE_CLIENT_ID=<YOUR_APPLE_CLIENT_ID>
    --dart-define APPLE_REDIRECT_URI=<YOUR_APPLE_REDIRECT_URI>
    

These values you must get on the Apple Developer Portal. Also, you can follow this link

Setting Facebook sign in

  • You must set the app id and the client token. For android, you must in the android/src/main/res/strings.xml file and for iOS, you must in the ios/Runner/Info.plist file.

These values you must get on the Facebook Developers. Also, you can follow this link for Android and this link for iOS

Setting Twitter sign in

  • You must set the Twitter api key, Twitter api secret and the redirect url in the Dart Define command setting the additional run arguments below
    --dart-define TWITTER_API_KEY=<YOUR_TWITTER_API_KEY>
    --dart-define TWITTER_API_SECRET=<YOUR_TWITTER_API_SECRET>
    --dart-define TWITTER_REDIRECT_URI=<YOUR_TWITTER_REDIRECT_URI>
    

These values you must get on the Twitter Developer. Also, you can follow this link


Setting Auth providers

Setting Azure AD B2C

  • You must set the Azure tenant name, tenant id, policy name, client id and the redirect url in the Dart Define command setting the additional run arguments below
    --dart-define AZURE_TENANT_NAME=<YOUR_AZURE_TENANT_NAME>
    --dart-define AZURE_TENANT_ID=<YOUR_AZURE_TENANT_ID>
    --dart-define AZURE_POLICY_NAME=<YOUR_AZURE_POLICY_NAME>
    --dart-define AZURE_CLIENT_ID=<YOUR_AZURE_CLIENT_ID>
    --dart-define AZURE_REDIRECT_URL=<YOUR_AZURE_REDIRECT_URL>
    

To get these values, you must follow these links:

Setting Auth0

  • You must set the Auth0 domain and client id in the Dart Define command setting the additional run arguments below
    --dart-define AUTH0_DOMAIN=<YOUR_AUTH0_DOMAIN>
    --dart-define AUTH0_CLIENT_ID=<YOUR_AUTH0_CLIENT_ID>
    

You can follow this link to guide:


Used packages

Dependencies

Dev dependencies