If you are experiencing “invalid signature” errors in your local environment, like I was for the past couple days, here’s the fix that worked for me! tldr: clear indexedDB from browser devtools. @dfinity/auth-client
is lovely and caches your DelegationIdentity
for you via indexedDB. However if you have a cached identity from a previous local replica, that replica will have a different public key and will cause “invalid signature” errors, since we are trying to certify responses with the public key of another chain. I hope this can save someone time
got it too sometimes . hope you did not debug it for too long
alternative: always develop in incognito mode and close/reopen your incognito tabs each time you change environment
I close and reopen my browser zillion times a day, that way I’m always sure there is no cached data
I’m not sure that disabling storage during local development is an ideal “local” behavior either. People can have complicated use cases.
It would be worth creating a troubleshooting section in the Readme, at the very least
Not disabling entirely, but storing it in a place that’s less persistent or clearing the indexedDB when initialising the authclient.
I’ve now run into this a few times as well.
For those using Firefox, this is how you can clear your local indexedDB.
- Open up dev tools → Storage
- Navigate to Indexed DB → →
auth-client-db
→ic-keyval
- Delete the delegate (or just wipe this whole key/value store and start with a fresh slate).
Here’s how you can view it in Chrome → View and change IndexedDB data - Chrome Developers