OneSignal / OneSignal-Unity-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Unity app with OneSignal. https://onesignal.com
Other
222 stars 61 forks source link

[question]: How to force add alias? #737

Closed AFB-MORA closed 5 months ago

AFB-MORA commented 6 months ago

How can we help?

I'm using Unity Authentication with anonymous, and Facebook login options. I'm using Unity player ID for external ID and facebook_id alias. I handle account linking conflicts as in Unity Documentation.

For example, a user logs in with Facebook on device A. Unity ID is UID1, and Facebook ID is FBID. Then the user logs in with Facebook on device B. Unity ID is UID2. I give 2 options: link local game (i.e. force link FBID to UID2 and remove FBID from UID1) or connect the other account (i.e. remove UID2 and connect as UID1). I have a problem with option 1. If the user chooses option 1, OneSignal external ID is set to UID2. But Facebook ID is still linked with UID1. As One Signal documentation says I must call OneSignal.login but I have no way of knowing UID1. Even if I knew UID1, login would be wrong. Because UID1 is another device, and current external ID is UID2. How can I force link FBID to UID2?

Code of Conduct

shepherd-l commented 5 months ago

You could use our Server REST API and call Delete Alias: https://documentation.onesignal.com/reference/delete-alias

Let me know if you have any questions

shepherd-l commented 5 months ago

If you call OneSignal.login again when the "Unity player ID" changes, I don't think it should conflict with the alias of the Facebook Id you are setting then. As for a given "Unity player ID", the Facebook Id should be consistent.

AFB-MORA commented 5 months ago

Thank you. REST API works like a charm.