所以我使用 firebase auth 连接到我在 tampermonkey 中制作的小型网络应用程序
auth.signInWithEmailAndPassword(email, password)
问题是当我在目标页面上使用它时,内容被阻止,因为
Content-Security-Policy
但这可以在 Firefox 中通过禁用 Content-Security-Policy 来修复
我尝试了什么
1 / 使用此脚本获取数据
fetch(auth.signInWithEmailAndPassword(email, password))
https://github.com/mitchellmebane/GM_fetch/blob/master/GM_fetch.js
2/ GM.xmlHttpRequest
GM.xmlHttpRequest({
method: "POST",
url: "...googleapis.com/v1/accounts:signInWithCustomToken?key="bla..bla",
headers: {
"Content-Type": "application/json"
},
data: {"email":email,"password":password,"returnSecureToken":true},
onload: function(response) {
auth.signInWithEmailAndPassword(email, password)
}
})
3 / Chrome 扩展
GM.xmlHttpRequest为我工作。示例:
// @grant GM.xmlHttpRequest
const response = await GM.xmlHttpRequest({
method: "GET",
url: "https://example-website.com/api/people,
});