简体   繁体   English

在 Chrome 扩展程序中安全地存储令牌/密码

[英]Securely store token/password in Chrome extension

I'm implementing a Chrome extension, which needs to access a 3rd party API endpoint using a token.我正在实现一个 Chrome 扩展程序,它需要使用令牌访问 3rd 方 API 端点。

How do I store a token securely in the Chrome extension, assuming other Chrome extension scripts can access the page's localStorage & cookie?假设其他 Chrome 扩展脚本可以访问页面的 localStorage 和 cookie,如何在 Chrome 扩展中安全地存储令牌?

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.您最多可以混淆它。

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唯一的方法似乎是调用您的服务器并让服务器执行涉及使用 API 密钥的请求或混淆它,例如通过在代码中转换为 base64 字符串,但即使这样它也会在开发人员工具网络选项卡中可见

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM