问题描述
我正在开发一个浏览器扩展。以下使用chrome.identity.launchWebAuthFlow
API的代码在一台机器上运行。我尝试使用浏览器的“加载未打包”功能将相同的代码加载到另一台计算机上,但是现在回调的redirect
参数是undefined
,而不是预期的URL字符串值。这导致整个事情失败。我回到了原来的机器上,使用相同的“ Load Unpacked”功能删除并再次添加了扩展名,现在它在该机器上也无法使用。在此期间,此代码或服务器没有任何更改。发生了什么事?
authenticateButton.addEventListener("click",() => {
const redirectURL = encodeURIComponent(chrome.identity.getRedirectURL());
const clientId = encodeURIComponent("ff");
const authURL = `https://linksaver.io/oauth?client_id=${clientId}&redirect_uri=${redirectURL}`;
return chrome.identity.launchWebAuthFlow(
{
interactive: true,url: authURL
},redirect => {
const parsed = new URL(redirect);
const token = parsed.searchParams.get("token");
chrome.storage.local.set({ token },() => {
showLogout();
});
}
);
});
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)