DroidconKotlin
DroidconKotlin copied to clipboard
Adding Firebase Auth
Adding support for Firebase Authentication
Adds a Login/Logout button in the settings screen, that will authenticate with google sign-in using Firebase. Then the user state is sent to the common code, to be used later.
Shared Code
- Adding
UserContextandUserDatafor commonly saved user information - Currently passing this information to the
UserIdProviderfor now, will be handled later - Adding abstract
AuthenticationServicefor calling for sign in / sign out from common ui to platform specific code - Passing
AuthenticationServiceintoSettingsViewModeland using that for compose calls
Platform Code
- Adding new Id "co.touchlab.droidconauthtest" for testing
- Adding
FirebaseAuthto android and iOS using Gradle and CocoaPods - Adding
FirebaseServicewhich is implementation ofAuthenticationServicefor each platform, to handle authentication - Adding authentication listener in
MainActivityandAppDelegateto save changes to the common code - Adding the ClientID as a
secretin Android. Not sure if this is needed
TODO
We are unsure about saving the clientID in public or as a secret. In android it is already a secret, however in iOS it's added in a URLScheme so it's more challenging to keep secret. Will look into this more.
Proof
Note for Android emulator you'll need to be signed into your emulator
Updated style
| signed in | signed out | |
|---|---|---|
| android | ||
| ios |