在开发过程中保持 Chrome 扩展 ID 相同 [英] Keep chrome extension id same during development

查看:34
本文介绍了在开发过程中保持 Chrome 扩展 ID 相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在不同的机器上测试我的 chrome 扩展程序,我看到扩展程序 ID 每次都发生变化,因为我将它作为解压缩的扩展程序加载.

I am trying to test my chrome extension on different machines, and I saw that the extension id changes every time since I am loading it as an unpacked extension.

但是,我真的需要保持相同的扩展名.我的扩展程序通过外部非 Google 提供商通过 OAuth 2.0.当我向外部提供商注册我的扩展时,我以以下形式提供了重定向 URIchrome-extension://<extension-id>/callback.html 如果我再次加载解压的扩展程序,id 会发生变化,我的应用程序将不再工作,因为重定向 URI 会发生变化.不断更改重定向 URI 实际上是不可行的.我如何保持相同的ID?

But, I really need to maintain the same extension id. My extension goes through OAuth 2.0 with an external non-Google provider. When I registered my extension with the external provider, I had provided the redirect URI in the form of chrome-extension://<extension-id>/callback.html If I load the unpacked extension again, the id changes and my app no longer works as the redirect URI changes. It's practically unfeasible to keep changing the redirect URI. How do I maintain the same id?

推荐答案

您需要根据生成的 pem 文件在清单文件中设置密钥.

You need to set the key in the manifest file, based on your generated pem file.

这里有获取 pem 的说明:https://developer.chrome.com/extensions/packaging

There's instruction on getting the pem here: https://developer.chrome.com/extensions/packaging

这里有关于关键字段的更多细节:https://developer.chrome.com/扩展/清单/密钥

And there's more detail on the key field here: https://developer.chrome.com/extensions/manifest/key

确保在生成后保存您的 pem 文件!它永远无法再次生成,您必须重新发布您的应用才能获得新应用.

Make sure you save your pem file once you generate it! It can never be generated again, and you'll have to republish your app to get a new one.

这篇关于在开发过程中保持 Chrome 扩展 ID 相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆