Reputation: 565
I built a custom authentication system using FirebaseAuthentication tokens.
My signup / login flow should work like this:
true
: sign in using FIRAuth.auth()?.signIn(withCustomToken:...
false
: Show a form to to enter custom information (name, etc..)
FIRAuth.auth()?.signIn(withCustomToken:...
My question is: How can I find out if the user has already signed up?
Would a publicly accessible database with only uid's
be the way to go?
Upvotes: 1
Views: 506
Reputation: 6459
The firebase sign in method will feedback in asynchronous callback.
FIRAuth.auth()?.signInWithEmail(email, password: password, completion: { (user , error) in
if let error = error {
print(error.localizedDescription)
return
}
self.signedIn(user)
})
If you haven't sign up yet. The error will print out
There is no user record corresponding to this identifier. The user may have been deleted.
Upvotes: 0
Reputation: 3599
This is fairly opinion based, but yes, I would use a standalone DB that stores each user's username who has signed up. Then all that is required is a quick web request through a PHP file querying for any rows returned with that username.
Upvotes: 2