A starter code for flutter apps with auth. Built on top of login example in Bloc library.
- Auth methods are implemented in the sub-package authentication_repository
- Firebase auth
- Email/password
- Sample login and sign-up forms, Change the design to suit your app design.
- Bloc based.
- Fix a valid package name for your project (required in firebase)
- It's
com.direvin.flutter_login_templatein this - Format must be:
com.<company>.<project>
- It's
- Go to you firebase console, create a new project.
- Create an Android app and an iOS app.
- Save both
google-services.json(android),GoogleService-Info.plist(ios) into your system.
- Save both
- Enable
Email/password,GoogleandFacebooksign-in methods in firebase console > authentication tab.- To enable
Facebooklogin, you would have to create a new app in facebook developer console and get the AppID and AppSecret
- To enable
- Create an Android app and an iOS app.
- Run the update script
./update.sh <App Name> <path to google-services.json> <path to GoogleService-Info.plist> <FBAppID>This scripts updates package name and other required fields in both android and ios directories. If you don't want to run this, in the following section, I've described the steps I followed.
- Done. Now you can build and run your App with authentication in both Android and iOS 🍻.
- Add your logo image to the
assets/directory - In
pubspec.yaml, updateflutter_icons > image_pathto the relative path of your logo - run
flutter pub run flutter_launcher_icons:main
-
Go to the firebase console, create a new project.
- Android:
- In firebase console, create an android app,
- Save
google-services.jsontoandroid/app/
- iOS:
- Create an iOS app in firebase console
- Save
GoogleService-Info.plisttoios/directory
- Android:
-
Change the package name in this project
- Checkout these
- Android
- In
app/build.gradle, updateandroid > defaultConfig > applicationIdwith your package name. - Update package name in the Manifest files.
android/app/src/profile/AndroidManifest.xmlandroid/app/src/main/AndroidManifest.xmlandroid/app/src/debug/AndroidManifest.xml
- Update App name in
android/app/src/main/res/values/strings.xml - Rename package in the MainActivity
android/app/src/main/kotlin/com/direvin/flutter_login_template/MainActivity.kt- Change it's parent directory name as well
- In
- iOS
- Update references in
Info.plist- Update
CFBundleURLSchemesarray withREVERSED_CLIENT_IDvalue fromGoogleService-Info.plist
- Update
- Update
PRODUCT_BUNDLE_IDENTIFIERvariables inios/Runner.xcodeproj/project.pbxproj
- Update references in
-
Enable
Email/password,GoogleandFacebooksign-in methods in firebase console -> authentication tab.- To enable
Facebooklogin, you would have to create a new app in facebook developer console and get the AppID and AppSecret, update these values in the following files. For more info, visit the flutter_facebook_login library README.android/app/src/main/res/values/strings.xmlios/Info.plist
- To enable
Steps I followed to create this are here: DOCS