You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using jwtToken to create a protected client. The jwtToken is generated each time a user logs in so new client has to be created on every login. But when i try to login after logging out, i get this error:
"The keyPrefix "private " is already in use. Multiple clients cannot share the same keyPrefix. Provide a different keyPrefix in the offlineConfig object."
I tried clearing the localStorage, sessionStorage, cookies and IndexedDB on logout but still got the same error on login.
After taking a look at the library code, I found the solution to this problem. Just add this code to aws-appsync/lib/client.js.
AWSAppSyncClient.prototype.clearKeys = function () {
keyPrefixesInUse = new Set()
return keyPrefixesInUse
};
I call this method during logout and it clears all the existing keyPrefixes so that a new client can be created. It works perfectly on my side. Please check and add this code to the library or suggest another solution to overcome the issue. Currently I've made the changes locally in my project. Waiting for a feedback. Thanks!
The text was updated successfully, but these errors were encountered:
I'm using jwtToken to create a protected client. The jwtToken is generated each time a user logs in so new client has to be created on every login. But when i try to login after logging out, i get this error:
Here is my client creation code.
I tried clearing the localStorage, sessionStorage, cookies and IndexedDB on logout but still got the same error on login.
After taking a look at the library code, I found the solution to this problem. Just add this code to aws-appsync/lib/client.js.
I call this method during logout and it clears all the existing keyPrefixes so that a new client can be created. It works perfectly on my side. Please check and add this code to the library or suggest another solution to overcome the issue. Currently I've made the changes locally in my project. Waiting for a feedback. Thanks!
The text was updated successfully, but these errors were encountered: