question

Adarsh Nambiar avatar image
Adarsh Nambiar asked

Unlink and Link DeviceID

Hi,

I am currently using LoginWithiOSID every time  the app is opened.

Hence the device ID is linked to PlayFab ID.Now there is an option for the user to add username and password later on to this PlayFab ID .I am able to do this by calling AdduserNamePassword API.Next time when the app opens it automatically logins and shows the username.

I am trying to create a "Logout" option when clicked,I will Unlink the device id from this playFabID and then the login option reappears.

I am succesfully able to Unlink the device id but when I Login back again and call the Link device id again,it shows error that 

Error linking Device ID:<DeviceID>

That identifier is already linked to a different user

 

How do I unlink and re link the device id on the same device?

 

10 |1200

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

brendan avatar image
brendan answered

[Edit - corrected below]

Can you give us the full set of repro steps, starting with a fresh account? I just tried this:

1. Create a new account using LoginWithIOSDeviceID, with CreateAccount set to true.

2. Add a username and password by calling AddUsernamePassword

3. Removed the iOS Device ID using UnlinkIOSDeviceID

4. Re-linked the iOS Device ID using LinkIOSDeviceID

And it worked fine - the ID was re-linked.

10 |1200

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

Adarsh Nambiar avatar image
Adarsh Nambiar answered

I will test again and confirm.The 4th point ,should it be "LinkIOSDeviceID"?

10 |1200

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

brendan avatar image
brendan answered

Whoop - yes, thanks - I'll edit above.

4 comments
10 |1200

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

tedforwardpub avatar image tedforwardpub commented ·

So you give your device to your friend so it will be theirs. Your friend will want their own playfab account, so they will not be using yours. How can this be done so that your friend will own their own account on the device that was preciously owned by you?


Do we call Unlink method which removes the link from the previous owner, and then create a new playfab account? According to what OP Adarsh is saying this couldn't be done.

0 Likes 0 ·
brendan avatar image brendan tedforwardpub commented ·

If it's an iOS device and you've uninstalled everything, it'll have a new Device ID anyway, so that's a non-issue. For Android, since the Device ID never changes, so it's a good best practice to provide a way for the user to unlink their Device ID. If they don't, it'll always be associated with the first PlayFab account.

0 Likes 0 ·
tedforwardpub avatar image tedforwardpub brendan commented ·

Ok, thanks for that. I was wondering about the iOS as I read in your tutorials that it resets. But for Android... with all the different log in options, what would be the correct API calls that would unlink the device from one account and then allow it to be linked to a new account?

0 Likes 0 ·
Show more comments
Adarsh Nambiar avatar image
Adarsh Nambiar answered

Ok I am able to relink the device id to the same user/playFabID  after unlinking .

But Can I link that device id to a different PlayFabID using LInkIOSDevicdeID . I am calling LinkIOSDeviceID  during PlayFab login process.It then throws error saying it is linked to a different user( which is not the case as I have unlinked that device id from other user).

 

 

10 |1200

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

brendan avatar image
brendan answered

Because Device ID is an authentication mechanism, it can only be linked to one PlayFab account. Otherwise, the service would have no idea of which account you mean to sign into when you use LoginWithIOSDeviceID, for example.

2 comments
10 |1200

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

tedforwardpub avatar image tedforwardpub commented ·

That being said, if you give your device to a friend is there is no way to unlink the original account to start fresh? If not then both users would be forever linked to the same device ID? Or could they still create a new PlayFab account but be linked to that device as well?

In other words, can a device ID be linked to more than one account, and just never trying to do a

LInkIOSDevicdeID to the new account?


0 Likes 0 ·
brendan avatar image brendan tedforwardpub commented ·

No, a single Device ID can only be linked to one PlayFab ID. Otherwise, we would have no way to know what account to sign you into when you log in with that Device ID. I'm not clear on your friend scenario, though. If you hand your device to your friend, and it's using the same Device ID, and you're logging in with Device ID, your friend would be playing in your account.

But to answer your first question, yes, you can use the Unlink... API calls to unlink any authentication method from the PlayFab account.

0 Likes 0 ·

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.