Create a different ways to login using Flutter Riverpod as state management and dependency injection.
- 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.
- For Android, you must rename the bundle id on
- You must follow the instructions for setting each third login in the steps follow this link.
- Run project and enjoy ๐
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.
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.
This scenario recreates the local auth login with the use of fingerprint (Android, iOS) or face id (iOS).
This scenario recreates the authentication with third providers like Facebook, Google, Apple and Twitter.
This scenario recreates the authentication using different mechanism like Azure Active Directory B2C and/or Auth0, enabling user/password, third logins, etc.
Before to start, you must create a JSON
file to set the dart-define variables. Create the JSON file
with the name config-keys.json
on the project's root.
{
// Set your key-values here
}
- You must set the json file in the Dart Define command, setting in the additional run arguments below
--dart-define-from-file=config-keys.json
- If you want to set the GoogleServices files follow this link
- If not, you must set the Google client id for Android and iOS, (as reverse mode for iOS) on the Info.plist file.
Also, set the Dart Define command setting the additional run arguments below
{ "GOOGLE_CLIENT_ID_AND": "<YOUR_GOOGLE_CLIENT_ID_AND>", "GOOGLE_CLIENT_ID_IOS": "<YOUR_GOOGLE_CLIENT_ID_IOS>", // More keys here... }
These values you must get on the Google Console.
- You must set the Apple client id and the redirect url as the Dart Define command setting the additional run
arguments below
{ // keys already exists... "APPLE_CLIENT_ID": "<YOUR_APPLE_CLIENT_ID>", "APPLE_REDIRECT_URI": "<YOUR_APPLE_REDIRECT_URI>" // More keys here... }
These values you must get on the Apple Developer Portal. Also, you can follow this link
-
You must set the app id and the client token as the Dart Define command setting the additional run arguments below.
{ // keys already exists... "FACEBOOK_APP_ID": "<YOUR_FACEBOOK_APP_ID>", "FACEBOOK_CLIENT_TOKEN": "<YOUR_FACEBOOK_CLIENT_TOKEN>" // More keys here... }
-
For iOS, you must the app id, the client token and the display name 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
-
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
{ // keys already exists... "TWITTER_API_KEY": "<YOUR_TWITTER_API_KEY>", "TWITTER_API_SECRET": "<YOUR_TWITTER_API_SECRET>", "TWITTER_REDIRECT_URI": "<YOUR_TWITTER_REDIRECT_URI>" // More keys here... }
-
For iOS, you must the redirect uri as well in the
ios/Runner/Info.plist
file.
These values you must get on the Twitter Developer or your apps here. Also, you can follow this link
-
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
{ "AZURE_TENANT_NAME": "<YOUR_AZURE_TENANT_NAME>", "AZURE_TENANT_ID": "<YOUR_AZURE_TENANT_ID>", "AZURE_POLICY_NAME": "<YOUR_AZURE_POLICY_NAME>", "AZURE_CLIENT_ID": "<YOUR_AZURE_CLIENT_ID>", "AZURE_REDIRECT_SCHEME": "<YOUR_AZURE_REDIRECT_SCHEME>", "AZURE_REDIRECT_PATH": "<YOUR_AZURE_REDIRECT_PATH>" }
-
For iOS, you must the redirect scheme as well, in the
ios/Runner/Info.plist
file.
To get these values, you must follow these links:
- You must set the Auth0 domain and client id in the Dart Define command setting the additional run arguments below.
- Android only: If you set a custom scheme you have to set a Dart Define key with your custom scheme.
{ // keys already exists... "AUTH0_DOMAIN": "<YOUR_AUTH0_DOMAIN>", "AUTH0_CLIENT_ID": "<YOUR_AUTH0_CLIENT_ID>", // Only if you have a custom scheme "AUTH0_SCHEME_AND": "<YOUR_AUTH0_SCHEME_AND>" }
You can follow this link to guide:
- Auth0 Flutter (auth0_flutter)
- Flutter Facebook auth (flutter_facebook_auth)
- Flutter local notifications (flutter_local_notifications)
- Flutter app auth (flutter_appauth)
- Formz (formz)
- Freezed annotation (freezed_annotation)
- Go Router (go_router)
- Google fonts (google_fonts)
- Google signIn (google_sign_in)
- Hooks (flutter_hooks)
- Intl (intl)
- Local auth (local_auth)
- Pinput (pinput)
- Riverpod with Hooks (hooks_riverpod)
- Shared preferences (shared_preferences)
- SignIn with Apple (sign_in_with_apple)
- Twitter login (twitter_login)
- Build runner (build_runner)
- Freezed (freezed)
- Very Good Analysis (very_good_analysis)