amazon-archives / aws-sdk-unity

ARCHIVED: The aws sdk for unity is now distributed as a part of aws sdk for dotnet:
https://github.com/aws/aws-sdk-net
Other
105 stars 43 forks source link

Cannot switch users using WipeData #81

Closed durnurd closed 8 years ago

durnurd commented 9 years ago

In our Unity game, you can change users by logging out of Facebook and logging in as a different user. When you log out, your data is wiped using CognitoSyncManager.WipeData()

The documentation for this method states:

Wipes all user data cached locally, including identity id, session credentials, dataset metadata, and all records. Any data that hasn't been synced will be lost. This method is usually used when customer logs out.

However, it does not appear to be the case that the identity is cleared. When logging in as a different user, I get this error:

Amazon.CognitoIdentity.Model.NotAuthorizedException: Logins don't match. Please include at least one valid login for this identity or identity pool. ---> 
Amazon.Runtime.Internal.UnityHttpErrorResponseException: Exception of type 
'Amazon.Runtime.Internal.UnityHttpErrorResponseException' was thrown

I must call CognitoAWSCredentials.Clear() as well for the credentials to actually be cleared.

karthiksaligrama commented 9 years ago

@durnurd sorry the documentation is slighlty incorrect. Its not meant to clear the identity and credentials. Alternatively i also think its a good idea to clear the credentials from within the WipeData api. For now You should call CognitoAWSCredentials.clear();

karthiksaligrama commented 8 years ago

Fixed in V 2.0.0.5