question

brendan avatar image
brendan asked

LoginWithAndroidDeviceID

deadstarcgs
started a topic on Sat, 07 March 2015 at 11:06 PM

I'm using Unity and LoginWIthAndroidDeviceID to allow a user who has already registered, logged in with PlayFab and linked their Android device to their account to automatically log them in the next time they open my game. This works perfectly in the Unity Editor.

However, when I try it on an actual mobile device, the code runs but it doesn't log my phone in. Instead I simply get the error message "Success".

Any assistance with this would be great.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

Best Answer
Brendan Vanous said on Mon, 09 March 2015 at 3:03 PM

Hi Mike,

This is indeed the recommended user flow for mobile titles - you want to get to as friction-free of an auth process as possible, as quickly as possible, though you should be careful not to lead the user down paths that will create a new account if he already has one. If you have locally saved data which says that the account is already set up, just sign in with Device ID (and continue to do so for subsequent re-auth calls). If not, check with the user to see what he wants to do, providing a way to sign into an existing account, if one exists. That way, if a user changes devices (or, in the iOS example, uninstalls all your apps and then installs one), you can still log him into the pre-existing account and update the Device ID to the new one.

The tough case is when a user has already played your game, gets a new device, and plays in "guest" mode (just signing in with Device ID). If he then tries to sign into a pre-existing account, you'll need to offer the option of using either account.

Also, yes, it is the case that a Device ID may only be assigned to one account for your title. The model used is that for Device ID sign-in, one user is the owner of the device. Any other users signing in on it would need to use an alternate method.

Brendan


10 Comments
johntube said on Sun, 08 March 2015 at 6:39 AM

I'm sorry but it's weird to LinkAndroidDevice or LoginWithAndroidDeviceID from the Unity Editor ?! And are you sure you want this at all, I mean device authentication instead of user authentication.


deadstarcgs said on Sun, 08 March 2015 at 2:41 PM

I can't really see why it would be weird, considering the Unity Editor generates it's own device ID when set to build in Android and has allowed me to test a lot of functionality before pushing my build to my phone.

And I'm using device authentication AFTER the user has first registered and the Android device has been linked to their account. This means it automatically finds the user's actual account and logs them in using their Android device ID rather than needing them to re-login to their PlayFab account manually.


johntube said on Mon, 09 March 2015 at 7:40 AM

How do you handle the scenario of the Device ID being changed ?

What about multiple users per device ? I don't think it is possible to link the same Device ID to multiple users ?


deadstarcgs said on Mon, 09 March 2015 at 1:38 PM

Obviously in the case of a new device ID, the user will have to login using Playfab again and the new device ID will be linked to their account. And no, it's not possible to link the same device ID to multiple accounts, but given the type of game I'm currently creating that won't be an issue.


Brendan Vanous said on Mon, 09 March 2015 at 3:03 PM

Hi Mike,

This is indeed the recommended user flow for mobile titles - you want to get to as friction-free of an auth process as possible, as quickly as possible, though you should be careful not to lead the user down paths that will create a new account if he already has one. If you have locally saved data which says that the account is already set up, just sign in with Device ID (and continue to do so for subsequent re-auth calls). If not, check with the user to see what he wants to do, providing a way to sign into an existing account, if one exists. That way, if a user changes devices (or, in the iOS example, uninstalls all your apps and then installs one), you can still log him into the pre-existing account and update the Device ID to the new one.

The tough case is when a user has already played your game, gets a new device, and plays in "guest" mode (just signing in with Device ID). If he then tries to sign into a pre-existing account, you'll need to offer the option of using either account.

Also, yes, it is the case that a Device ID may only be assigned to one account for your title. The model used is that for Device ID sign-in, one user is the owner of the device. Any other users signing in on it would need to use an alternate method.

Brendan


johntube said on Mon, 09 March 2015 at 4:34 PM

This is indeed the recommended user flow for mobile titles. So is it a like "standard" widely used by almost all mobile games out there ?

I'm more of an Android guy so I will talk more about Android, the ANDROID_ID specifically :

One good thing is that it can handle multiple users per device as stated in the official documentation :

Note: When a device has multiple users (available on certain devices running Android 4.2 or higher), each user appears as a completely separate device, so the ANDROID_ID value is unique to each user.

But you can also read in the Android developers blog post provided in LoginWIthAndroidDeviceID documentation page that "There are downsides: First, it is not 100% reliable on releases of Android prior to 2.2 (?Froyo?). Also, there has been at least one widely-observed bug in a popular handset from a major manufacturer, where every instance has the same ANDROID_ID".

If I want my game to be "cross-devices" : the user can install it on various devices and play on any of them without having to logout from one device and login to the other. I think that it is still possible to use device authentication with this use case. I mean is it possible to have multiple devices linked to a single account ?


Brendan Vanous said on Wed, 11 March 2015 at 6:30 PM

Many phone games do have the concept of a "guest" account that they use for gameplay at first, in order to get the player into the action without a sign-up, yes. Past that, titles use a variety of methods for getting players into "full" accounts. Given that an account is created for the player when they use one of the transparent sign-in mechanisms, like Device ID, this is a recommended pattern for titles in our service - but it's not necessarily universal to all titles. It's best to evaluate your title's needs, so that you can review our recommendations through that filter, and adjust as needed.

Right now, a player account can only have one Android Device ID and one iOS Device ID (one of each) associated with it. This is a known limitation which we'll be addressing shortly.


johntube said on Wed, 11 March 2015 at 7:20 PM

Should I add this (linking multiple mobile devices' IDs (Android and iOS) to the same user) to the features list ?


Brendan Vanous said on Wed, 11 March 2015 at 10:59 PM

Certainly - the more feedback we can get on how valuable this would be across the user base, the better. :)


Brendan Vanous said on Sun, 26 July 2015 at 1:54 PM

Update: We've added the ability to link multiple devices of each type to the player account. So now, you can have a user with an iPad and iPhone both linked to the account, for example.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.