7

I'm developing my first app using firebase. I've run into some problems with the login.

Basically, what I've got so far:

  • Users can login with their google account
  • Users can login anonymously
  • User data is stored in firebase real time database using the UID from firebase authentication as unique key

My problem

When a user uses the app for the first time, they don't have an account yet and if they have no internet connection, they won't be able to create one (at least I think so).


My question

What is the best way to handle this? Is there a possibility to get a unique key without internet connection? Should I ask the user to create a internet connection? Other possibilities?

2 Answers 2

6

Creating a Firebase Authentication user account requires making a connection to the Google servers. Unfortunately this even applies when you use anonymous authentication.

So currently the only option (within Firebase Authentication) is to have the user connect to the internet to complete the registration.

Sign up to request clarification or add additional context in comments.

3 Comments

Is it possible to do simple Firebase authentication with an existing user account if there is no internet connectivity?
There is no way to authenticate a user if they're not connected to the internet. It would require that somehow the device contains knowledge of all possible user's credentials.
@FrankvanPuffelen just to confirm this is still true, can you not use the Credential API to save user login information on the device
1

You can see if the user is authenticated offline only if he has already logged in or registered before, and then he saved the user again in the FirebaseAuth.instance.. but for every request he needs the connection.

In my case I'm using Flutter:

var user = await FirebaseAuth.instance.currentUser();

This offline log status allows you not to present a login or registration page every time the user is offline and opens your app.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.