WagglyWonga
WagglyWonga

Reputation: 351

Creating unique users for a leaderboard in iOS game

I'm looking at implementing a leaderboard in to my iOS game, and after a little research I've decided to use Firebase to store the leaderboard data.

Users in the game can login via Facebook and their userID is then used to create a unique record in Firebase. However, for players who don't want to authenticate via Facebook or the other methods (Email, phone number, etc) how would I go about creating a unique ID in the game so they can still post their scores to Firebase?

Upvotes: 0

Views: 199

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 599946

Firebase also support anonymous authentication, which seems ideal for this. From that documentation:

You can use Firebase Authentication to create and use temporary anonymous accounts to authenticate with Firebase. These temporary anonymous accounts can be used to allow users who haven't yet signed up to your app to work with data protected by security rules. If an anonymous user decides to sign up to your app, you can link their sign-in credentials to the anonymous account so that they can continue to work with their protected data in future sessions.

Don't take that "temporary" too serious there. Anonymous accounts remain valid, unless you force them to sign out. After that they can't be recovered.

Upvotes: 1

Related Questions