I have a Facebook Web Game that I converted to Android and iOS using PhoneGap. I can use Facebook for authentication on my mobile apps, but I would also like to allow the user to play as a guest. I've seen various games implement this workflow before and I'm curious how it is actually done. What unique identifier is the phone sending to the server to authenticate against? Does each phone have something unique about it that PhoneGap can expose via a plugin? Does anyone know the logic behind the "Play As Guest" feature many mobile games implement?



A quick look at the documentation reveals that you can easily access the device identifier via device.uuid. From here, it should be easy to use this as an ID for the server.

If that fails, another approach would be to just create a new GUID to use as an identifier, and persist it on the device for reuse.

Depending on your game it might be worth asking if you even need to talk to a server, or can just let the guest play offline without autentication at all, but without knowing what your game entails I can't say for sure.

  • \$\begingroup\$ Thank you for the response. I ran into the cordova-plugin-device link but read this value can get reset in certain circumstances. Like if the device changes carriers, or the app is uninstalled then reinstalled, or the app simply gets updated. It looks like the plugin also exposes the device serial number. Maybe I can use that as well if the uuid somehow fails or resets. At any rate I think this is probably the best solution as is. Thanks again for the response. \$\endgroup\$
    – hanesjw
    Jun 22 '18 at 3:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .