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

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

问题描述

我正在尝试在不同的计算机上测试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.

但是,我确实需要保持相同的扩展名.我的扩展程序通过OAuth 2.0与外部非Google提供程序一起使用.当我向外部提供商注册扩展程序时,我以以下形式提供了重定向URI: chrome-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扩展名相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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