admin管理员组文章数量:1122832
I’m building a Chrome extension using the WXT framework and trying to integrate Firebase Google authentication, but I keep running into CSP-related issues. Here’s the situation:
Error from Content Security Policy (CSP):
Refused to load the script '.js?onload=__iframefcb620453' because it violates the following Content Security Policy directive: "script-src 'self' 'wasm-unsafe-eval' http://localhost:3000". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
Firebase auth error:
Uncaught (in promise) FirebaseError: Firebase: Error (auth/internal-error).
I can’t find where to catch this error, so debugging it has been difficult
My attempts:
I suspect the problem is related to the manifest.json configuration, particularly the content_security_policy field. Using the WXT framework, I tried defining the CSP like this:
import { defineConfig } from "wxt";
// See /api/config.html
export default defineConfig({
srcDir: "src",
extensionApi: "chrome",
modules: ["@wxt-dev/module-svelte"],
manifest: {
content_security_policy: {
extension_pages:
"script-src 'self' 'wasm-unsafe-eval' http://localhost:3000 ; object-src 'self';",
},
},
});
However, when I include in the CSP, the extension fails to load and throws this error:
Failed to load extension from: /<my project directory>/.output/chrome-mv3. 'content_security_policy.extension_pages': Insecure CSP value "; in directive 'script-src'.
This is my first time building an extension and first using WXT too. So any help would be great
本文标签:
版权声明:本文标题:How to Fix Firebase Google Authentication CSP Errors in a Chrome Extension (Manifest v3, WXT Framework) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736302867a1931687.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论