I am using firebase for the backend of an iOS application written in Swift3.
I do not want my users to enter any critical arguments, so I use anonymous authentication.
In my appDelegate in application func, I call:
FIRAuth.auth()?.signInAnonymously() { (user, error) in ... }
This means that every time the user launches the application, I call this function. So far, in my testing phase, it works as I expected. This means that I get the same UID every time.
Can I assume that I will get the same UID if the user does not delete the application?
I saw that in FIRUser I can get a token using getTokenWithCompletion . Shouldn't I use something to sign up using this token, and not every time using signInAnonymously ?
I tried with func signIn(withCustomToken token: String, completion: FIRAuthResultCallback? = nil) , but then I saw that this is used when using a self-signed user authenticator. what is wrong here.
What I want to avoid is my user, in order to start saving data and for some reason after the X-time has lost all the data saved since they are logged in with a new UID.
Thanks and Regards
source share