Firebase Auth - progressive web app (polymer) offline mode - firebase

Does firebase auth still keep the user in offline mode of a progressive web app ?
How does firebase auth works if the app is in offline ? Would like to know the two scenario.
User want to login for the first time during the app is in offline (app is using pouchDB & CouchDB for sync)
User already signed in, but app became offline. Does this mode even still work with firebase auth ?
Regards,
Sowmyan

Authenticating the user requires an active connection. There is no way for Firebase to authenticate your users without connecting to its servers.
Once the user is authenticated, the app will continue working when the user goes offline. Firebase Database operations will be reading from the local cache and writing to a queue. Once the connection is restored, the user's authentication token is (if needed) refreshed and the writes are sent to the server.

Related

Firebase refresh token usage in backend

I have 2 app (Provider and Client). I have added Firebase auth to Provider app. I register in Provider app and save Provider's information in firebase and also its some information in my server(refreshToken, pairing code, providerID)
In Client app I write Provider's pairing code for matching with provider (checking this pair code has or not in my server). If client's login success I get refreshtoken and login in firebase with token.
The reason I save refresh token in my server I want to change some info in Firebase from Client app and create auth between client app and server.
The question I searched in google and I see this way is insecure that saving user's refresh token in database.
Is this way is secure?
How I create this flow?
When I disable account in firebase auth list, refresh token works still

Where is the firebase session stocked in React Native?

I was wondering since I don't find the answer online, where or "how" is the firebase user session (using auth()) stocked in React Native ?
I know it's open source but I can't find what I want. If possible I would like to know the location/way for both ios and android.
In browser based environments, Firebase Authentication stores the user credentials in local storage, and restores them from there when the page reloads.
In native Android environments, Firebase Authentication stores the user credentials in the shared preferences of the app, and restore them from there when the app reloads.
In native iOS environments, Firebase Authentication stores the user credentials in the user's keychain, and restore them from there when the app reloads.
If you need to control the storage of the user credentials in a JavaScript environment, check the documentation on auth state persistence to learn about your options.

Using firebase authentication in apps with backend in Azure?

I want to use Firebase Authentication in my mobile app, however I want to host the mobile backend (REST API and database) on Azure. In this case, how would I get the identity information from Firebase over to Azure, e.g. how would I check in my Azure backend if a token sent from my mobile app to the Azure backend is valid, get the name of the logged in user etc?
You can use the Firebase Admin SDK to verify auth ID tokens sent from your app to your backend.

How to let logged-in user connect to database securly? JWT?

I am making a mobile app with my custom API on AWS, firebase auth and firestore. I want to make secured connection:
- prevent MITM attack between client and AWS, and between client and firebase store
- prevent anybody to make request (and accept request only from mobile app)
Firestore
|(<- should be secure)
User - Firebase Auth
|(<- should be secure)
AWS EC2
Should I use JWT? Does anybody know how to use it on firebase auth?
I have used JWTs previously to allow a user’s login state persist on different sub domains on the same root domain (as Firebase does not do this natively). Check out this article:
https://dev.to/johncarroll/how-to-share-firebase-authentication-across-subdomains-1ka8
It may help with auth and JWT! It will allow you to authenticate in both backend and frontend.

Login strategy on Xamarin forms an Azure

I am using the ADAL3 for authenticating on the Azure AD app. Then I use the AuthenticatedClient Async for logging into the Azure backend.
What is the correct strategy for consuming Azure backend and working with token? Do you call AuthenticateClientAsync before each call to the backend to be sure that if the session expires on the backend the token will be used to start the session automatically? What append if the memory save token is expired, do you manually ask users to login again?
Someone has a sample of an app that popup a login page then call some service and popup a new login page if needed?
Thanks for your help.
According to your description, I assumed that Azure Mobile Apps would be the approach for you to work as your mobile backend. And you could authenticate your customers with AAD and leverage the client SDKs provided by Azure Mobile Apps to communicate with your azure mobile app backend.
I would recommend you follow this tutorial for creating your Azure Mobile App and download the sample project for getting started. Then, you could configure your mobile app to use AAD login, details you could follow here. Moreover, more details about how to use the client SDKs for Azure Mobile Apps in your xamarin project you could follow here.
Someone has a sample of an app that popup a login page then call some service and popup a new login page if needed?
After logged via MobileServiceClient.LoginAsync, you would retrieve a JWT token issued by your mobile app backend and you could get it by accessing MobileServiceClient.CurrentUser.MobileServiceAuthenticationToken. And you could cache the token for reusing it. You could wrap the operations against your mobile app backend and catch the exception when the token is expired and manually call LoginAsync to ask the user for logging again or validate the token in your client side and re-login if the token is invalid before you send requests to your mobile app backend. For caching the token and validate the token, you could follow adrian hall's book about Caching Tokens. For wrapping the table operations, you could follow here.

Resources