Closed hgray closed 9 years ago
Does this happen every time? It might happen that you actually have two identities and it's merging them, but that should only happen once.
It seems to be happening every time. I did have two identities in my player prefs, but have since cleared them out.
Steps to reproduce:
Incidentally, something else odd is happening in this flow. I'm ending up with several datasets in my database. Where is that coming from for a new unsynced identity?
I found the reason: I was calling credentials.GetCredentialAsync() at the end of init(). Maybe it's overlapping requests? I guess I should use the synchronous call once the identity change has been triggered?
I was trying to confirm credentials after a login (unauthenticated or authenticated) by calling the GetCredentialAsync() and then checking the exception/result. This leads to the above issues. I have removed that for now and confirmed that the identity isn't created twice.
However, the question is how can we confirm valid credentials?
Follow these steps in the demo project:
What ends up happening is a previously authenticated ID is stored in cache, but as I didn't pass in a token, it fails. The problem is that we don't know it has failed until a dataset tries to sync.
Other things I've tried:
So, I guess what I'm asking is whether we can resolve the above issue so that we can use something like GetCredentialAsync() to confirm a valid credential exists prior to attempting a sync.
I've found that waiting for the response to GetCredentialsAsync() before calling a synchronize serves my purpose and doesn't cause the multiple identities.
Reopening because it's something that we probably want to fix.
Fixed in version 2.0.0.5
Just a heads up for you all...
In the CharacterSelection demo, I've added an event listener to credentials identity changed event: credentials.IdentityChangedEvent += HandleIdentityChanged;
When I create a new identity, the handler is fired three times and is showing two different ids: new_id_1 new_id_2 new_id_1
No biggie, just wanted you all to be aware.