How to configure social login?
- Create a firebase project.
- First you need to have a google account and login in your browser.
- Goto this link: https://console.firebase.google.com/
- Click the “Add Project” Button.
- Add your project name and continue.
- Off the “disable google analytics” and Click the “Continue” Button.
- Click the “Continue” Button.
Add Android app on your Firebase project
- Click the android icon.
Add some informations:
- Android package name
- App nickname
- Add signing certificate SHA-1 and SHA-256
How to get SHA-1 code in your project ?
- Goto android studio and open your project then open terminal and ensure that it shows your project directory in the terminal.
- Then drive into the android folder(cd android).
- For debug mode: write this command on your android studio terminal “./gradlew signinReport” then press enter.
- For release mode: write this command on your android studio terminal “keytool -list -v
- Click the “Register App” button
- Download config file and add this file into your project->android->app folder
- Add firebase SDK
- Click the “Continue to console” button
- After upload your app on playstore you need to add signing certificate SHA-1 and SHA-256 in firebase project setting: Open your google play console->Your App->Setup->App integrity
You must generate your own google-services.json. Do not use ours – it will not work for you.
Firebase Authentication :
- Goto signin method and then enable Google, facebook and twitter and apple.
- For facebook you need a facebook app id and app secret, we will create the next step.
Add these documents.
- Facebook: Package Used
https://pub.dev/packages/flutter_facebook_auth
See its documentation and steps:
How to create a facebook app ?
- First you have to login facebook in your browser.
- Goto https://developers.facebook.com/
- Goto My Apps.
Create an app.
Select App Type None.
- Add your app details
- App Name.
- App Contact Email.
- Business Account. (Don’t Change it).
- Add product “Facebook Login”.
- Click the “Set Up” button.
Click the “Basic” Option.
- Add some information and save it.
- This app privacy policy url.
- This app terms of service url.
- This app icon (Icon size also 1024 X 1024 Or 512 X 512 ).
- This app category.
- Now activate your app.
- Click the “Switch Mode” Button.
- Make sure your app facebook login settings are on these options.
- Client OAuth Login.
- Web OAuth Login.
- Enforce HTTPS
- Use Strict Mode for Redirect URIs
Integration
For Android:
- Add your facebook app id, app name, facebook_client_token and fb login protocol scheme (**NOTE**: The scheme needs to start with `fb` and then your ID.example: fb123456789)
into your project->android->app->src->main->res->values->string.xml file.
Google: Package Used
Twitter : package used
https://pub.dev/packages/twitter_login
How to create a Twitter app.
- First you have to login twitter in your browser.
- Go to https://developer.twitter.com/
- Go to Developer Portal.
- Go to Project & Apps->Overview create a new project.
Filup some information for your project. Project Name, Use case, Project description.
- Setup your app
- Select your app environment.
- Enter your app name.
Collect your API Key and API Key Secret.(you will have to collect it.)
- Setup user authentication setting.
- Go to Project & Apps-> select your project and then select your created app.
- Find User authentication settings.
- Click the Setup button.
- Enable OAuth 2.0
- Select Type of App.(Native app)
- Callback URl.(activematrimonialflutterapp://).
- Web site URL.(It’s your web URL).
- Save it.
- Setup in your flutter e-commerce code.
- Go to your flutter project->lib->social_config.dart
- Enter your twitter_consumer_secret and twitter_consumer_key.