Please include the following information in your post:
- Which SDK this is regarding: auth0-spa-js
- SDK Version: 1.19.4
- Platform Version: Chrome 99
- Code Snippets/Error Messages/Supporting Details/Screenshots:
We are using auth0-spa-js SDK getTokenSilently() method to get/refresh token and utilize token in REST API call.
It works perfectly unless SDK is initialized/invoked inside browser Worker (ContextWorker). SDK initialization fails as it tries to access ‘document’ object which is not accessible inside Worker.
Error says: AUTH0_ERROR: ReferenceError. document is not defined.
It becomes clear that sdk is not meant for using inside contextWorker.
What is proper approach for silent token refresh inside worker that performs API requests?