如何修改Chrome扩展程序,它通过Google的OAuth 2验证每个用户? [英] How to modify Chrome Extension, which authenticates every user through Google's OAuth 2?

查看:160
本文介绍了如何修改Chrome扩展程序,它通过Google的OAuth 2验证每个用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从一个扩展中修改一个小东西。我基本上需要编辑,是他们使用的选择器。如果他们的选择符是 $(#firstDiv)我需要它是 $(#secondDiv)。这真的很简单。



我下载了CRX文件,提取了它,进行了编辑,但是当我将它安装到浏览器中时,它会要求我进行身份验证与Google身份验证器一起使用。就像它应该这样做,因为它使用oAuth 2。但是,一旦我登录到我的Google帐户,它不会保存登录。在登录并按下登录后,该选项卡关闭,并在另一个页面上再次启动相同的登录页面。



是否有可能以某种方式更改?我找到了一个半解决方法。如果我安装了扩展程序,请使用Google进行身份验证,然后在扩展文件夹中进行编辑,它可以很好地工作。但是,我无法将其发送给其他人,因为 manifest.json 包含了我的身份验证密钥(长度为392个字符)。



我如何根据需要修改扩展名?有什么我需要知道的谷歌OAuth?



编辑:好的,我甚至不能直接从Google下载.crx文件,解压文件,然后移动文件到一个新的文件夹,并安装该脚本。完全像它来自谷歌。他们的.crx文件是否被签名?这是不可能的吗?

解决方案

当您下载.crx文件时,解压缩,编辑并安装它,扩展名ID是从原来的一个更改(这是您一次又一次获得登录页面的原因)。现在,扩展中使用的客户端ID仅对原始扩展名有效。这就是为什么当你从网上商店安装它时,它可以正常工作,因为它保留了原始的扩展名。



解决方案:



您必须保留原始的扩展名才能使其正常工作。首先下载 crx 查看器(对扩展程序开发人员非常有用)



安装crx查看器后,从网上商店导航至您的扩展程序。你会注意到一个页面动作(在url结尾的图标)。点击它,然后点击查看源代码。新选项卡将打开,然后按f12并检查控制台,您会发现一个键值。复制它。现在再次转到您的扩展页面并将扩展名作为zip(从crx)下载。提取它并打开它的manifest.json文件并粘贴key和value(这一步对于保留扩展id是必需的)。现在,通过启用开发者模式并单击加载解压后的扩展并选择提取的扩展,从chrome安装扩展。它应该现在工作

I am trying to modify a small thing from an extension. All I basically need to edit, is the selector they use. If their selector is $("#firstDiv") I need it to be $("#secondDiv"). It is really that simple.

I downloaded the CRX file, extracted it, made the edit, but when I go and install it in my browser, it asks me to authenticate with Google Authenticator. Just like it's supposed to do, as it uses oAuth 2. HOWEVER, once I log into my Google account, it will not "save" the login. Right after I log in and press Log In, the tab closes and launches the same login page again on another page.

Is it possible to change that somehow? I found a semi-workaround. If I install the extension, authenticate with Google, then go make my edit in the extension folder, it works perfectly. However, I cannot send it to someone else, because the manifest.json includes my authentication key (392 characters long).

How can I modify the extension to my needs? Is there something I need to know about Google OAuth?

EDIT: Okay, I cannot even download the .crx file directly from Google, unzip the file, then move the files into a new folder, and install that script. Exactly like it came from Google. Are their .crx files signed? Is it impossible to do this?

解决方案

When you download the .crx file, extract it, edit it and install it, its extension id is changed from the original one(this is the reason you are getting login page again and again). Now, client id used in extension is valid for only the original extension id. Thats why when you install it from web store it works fine because it retains its original extension id.

Solution :

You must retain the original extension id to make it work. First download crx viewer(very helpful for extension developers)

After installing crx viewer, navigate to your extension from web store. You will notice a page action(icon at the end of url). Click it , then click view source. New tab will open, then press f12 and check the console, you will find a "key" value. Copy it. Now go to your extension page again and download the extension as zip(from crx). Extract it and open its manifest.json file and paste the "key" along with value.(This step is necessary to retain extension id). Now install the extension from chrome by enabling developer's mode and clicking load unpacked extension and selecting the extracted extension. It should work now

这篇关于如何修改Chrome扩展程序,它通过Google的OAuth 2验证每个用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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