Reputation: 1268
I'm implementing a Chrome extension, which needs to access a 3rd party API endpoint using a token.
How do I store a token securely in the Chrome extension, assuming other Chrome extension scripts can access the page's localStorage & cookie?
Upvotes: 9
Views: 3410
Reputation: 2420
I too don't see how it could be done. The only ways seem to be either calling your server and have server do the request that involves using the API key or obfuscate it for example by converting to base64 string in code but even then it'll be visible in developer tools network tab
Upvotes: 0
Reputation: 19835
Other scripts cannot access your storage. But a user can always debug your script and see it. You wont be able to encrypt it. At most you can obfuscate it.
Upvotes: 5