如何清除 Chrome 中的基本身份验证详细信息
我正在开发一个使用基本身份验证的网站。使用 Chrome 我已经使用基本身份验证登录。我现在想从浏览器中删除基本身份验证详细信息并尝试不同的登录。
使用Chrome时如何清除当前的基本身份验证详细信息?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我正在开发一个使用基本身份验证的网站。使用 Chrome 我已经使用基本身份验证登录。我现在想从浏览器中删除基本身份验证详细信息并尝试不同的登录。
使用Chrome时如何清除当前的基本身份验证详细信息?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(30)
如果您在网址中包含用户名,Chrome 似乎总是会显示登录提示,例如
http://[电子邮件受保护]
这不是真正的完整邮件解决方案,请参阅下面的 Mike 的评论。
It seems chrome will always show you the login prompt if you include a username in the url e.g.
http://[email protected]
This is not a real full solution, see Mike's comment below.
每次进行测试时,您都可以打开隐身窗口 Ctrl+Shift+n。隐身窗口不会记住您上次输入的用户名和密码。
要使用此技巧,请确保关闭所有隐身窗口。所有隐身窗口共享相同的缓存。换句话说,您无法打开多个独立的隐身窗口。如果您登录其中一个窗口并打开另一个窗口,则这两个窗口是相关的,您将看到新窗口记住了第一个窗口的身份验证信息。
You can open an incognito window Ctrl+Shift+n each time you are doing a test. The incognito window will not remember the username and password the last time you entered.
To use this trick, make sure to close all incognito windows. All incognito windows share the same cache. In other words, you cannot open multiple independent incognito windows. If you login in one of them and open another one, those two are related and you will see that the new window remembers the authentication information from the first window.
您所需要做的就是在地址栏中输入chrome://restart,chrome及其在后台运行的所有应用程序将重新启动,并且身份验证密码缓存将被清除。
all you need to do is to type chrome://restart in the address bar and chrome, with all its apps that are running in background, will restart and the Auth password cache will be cleaned.
当您退出 Chrome 时,身份验证将被清除。
但请注意,默认情况下 Chrome 在后台运行应用程序,因此即使您关闭所有 Chrome 窗口,它也可能不会真正退出。您可以在高级设置下更改此行为,或者例如在 Windows 下,您可以使用系统托盘中的 Chrome 图标完全退出 Chrome。如果 Chrome 仍在运行,应该会有一个图标,但也许您只能在带有隐藏图标的弹出窗口中找到它。 Chrome 图标的上下文菜单有一个用于完全退出 Chrome 的条目,您还可以使用该菜单更改在后台运行的应用程序的设置。
设置
显示高级设置...
系统
下取消选中标记为:< br>Google Chrome 关闭时继续运行后台应用
The authentication is cleared when you exit Chrome.
Note however, that by default Chrome is running apps in the background, so it may not really exit even if you close all Chrome windows. You can either change this behavior under advanced setting, or e.g. under Windows, you can completely exit Chrome by using the Chrome icon in the systray. There should be an icon if Chrome is still running, but maybe you'll find it only in the popup with the hidden icons. The context menu of the Chrome icon has an entry to completely exit Chrome, and you can also change the setting for running apps in the background using that menu.
Settings
Show advanced settings...
System
uncheck the box labeled:Continue running background apps when Google Chrome is closed
这是一个快速技巧。
例如,您已经通过
user1:password1
在 urlhttps://example.com
中输入了基本身份验证。要清除它,只需打开新选项卡,然后:转到:
https://any:[ email protected]
那么您的密码将被删除。any:any
是任意字符串。This is a quick trick.
For example you already input basic auth to url
https://example.com
byuser1:password1
. To clear it just open new tab then:Goto:
https://any:[email protected]
then your password will be removed.any:any
is any string.我使用的是 Chrome 版本 83,这就是我的做法。在执行这些步骤之前,请确保您要删除其身份验证详细信息的站点的选项卡已关闭。
首先,转到
设置
>>>隐私和安全
。然后点击
站点设置
选项然后点击
查看跨站点存储的权限和数据
选项搜索您要删除其身份验证信息的网站。在此示例中,我使用的是 Stack Overflow。
现在单击该网站,然后单击
清除数据
按钮。现在重新启动浏览器,系统将要求您重新登录。要重新启动,您可以在地址栏中输入
chrome://restart
。I am using Chrome Version 83 and this is how I did it. Before following the steps make sure the tab of the site, whose Auth Details you want to delete is closed.
First, go to
Settings
>>Privacy and security
.Then click on
Site settings
optionThen click on
View permissions and data stored across sites
optionSearch for the site whose Auth info you want to delete. In this example, I am using
Stack Overflow
.Now click on the site and then click the
Clear data
button.Now restart your browser and you will be asked for a fresh login. For restarting you can type
chrome://restart
in the address bar.只需执行
...即可覆盖您的旧凭据。
Just do
...to override your old credentials.
这并不完全是问题所要求的,但如果您不小心保存了基本身份验证凭据并想要清除它们或更新它们:
https://support.google.com/accounts/answer/6197437
可以通过以下链接快速导航步骤 1-4:chrome://settings/passwords
这适用于 Chrome 版本 59.0.3071.115
This isn't exactly what the question is asking for but in case you accidentally saved basic auth credentials and want to clear them or update them:
https://support.google.com/accounts/answer/6197437
Steps 1-4 can be quickly navigated with this link: chrome://settings/passwords
This worked in Chrome Version 59.0.3071.115
正如 @SalCelli 提到的,
chrome://restart
有效。但是,这会重新启动所有选项卡。另一种方法是按照CEGRD的建议以隐身模式启动。
但是,如果您不想重新启动&使用隐身模式,在 Chrome 86 (Mac) 上,我发现 @opsb & 提供的答案Mike 仅适用于以下附加步骤。
在没有资源的 URL 中输入错误的用户名
例如:如果网址是
http://mywebsite.com/resources/
,如果我输入http://将不起作用 href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0473766b6a6344697d736166776d70612a676b69">[email protected]/resources/
,但如果我仅输入http://将起作用 “/cdn-cgi/l/email-protection” class =“__cf_email__” data-cfemail="1f686d7071785f7266687a7d6c766b7a317c7072">[电子邮件受保护]/
但是,输入有效凭据将不起作用,因为在后台,chrome 仍然会发送错误的用户作为 url 的一部分,即使url 显示在地址栏右侧 当提示输入凭据时,您需要
取消
,然后单击地址栏并按enter
重新加载页面。 现在输入正确的密码As mentioned by @SalCelli,
chrome://restart
works. However, this relaunches all the tabs.Another method is to launch in incognito mode as suggested by CEGRD
However, if you could not like to restart & use incognito, on Chrome 86 (Mac), I found that the answer provided by @opsb & Mike only works with the below additional steps.
Enter the wrong username in the url without the resources
eg: if the url is
http://mywebsite.com/resources/
, it will not work if I enterhttp://[email protected]/resources/
, but will work if I enter onlyhttp://[email protected]/
However, entering the valid credentials will not work, as in the background, chrome still send the wrong user as part of the url, even though the url appears right in the address bar When prompted for credentials you would need to
Cancel
, and click the address bar and reload the page from pressingenter
. Now enter the correct password目前还没有办法在 Chrome 中执行此操作(Chrome 58),
我发现最好的解决方案是在隐身窗口中打开 URL,这将迫使您重新输入基本身份验证凭据。
当您想要更改凭据时,请关闭隐身窗口并启动另一个隐身窗口。
There is no way to do this in Chrome as yet (Chrome 58)
I have found the best solution is to open the url in an Incognito window, which will force you to re-enter the basic authentication credentials.
When you want to change the credentials, close the Incognito window and launch another Incognito window.
可能是旧线程,但想添加答案以帮助其他人。
我在高级 ReST 客户端应用程序中遇到了同样的问题,我无法从 Chrome 或应用程序中清除基本身份验证。它只是停止要求凭据!
不过,我设法通过使用“关于 Google Chrome ->”重新启动 Chrome 来使其正常工作。重新启动。
Chrome 重新启动后,当我访问 ReST 服务时,它将使用基本身份验证弹出窗口询问用户名和密码。
希望这有帮助!
May be old thread but thought of adding answer to help others.
I had the same issue with Advanced ReST Client App, I'm not able to clear basic authentication from Chrome neither from app. It simply stopped asking for credentials!
However, I managed to make it work by relaunching Chrome using About Google Chrome -> Relaunch.
Once Chrome is relaunched, when I accessed ReST service, it will ask for user name and password using basic authentication popup.
Hope this helps!
这里有很多很棒的建议,我将给出我认为最有效的一个:
只需更改网站中的密码即可。旧的身份验证将变得过时,Chrome 将再次请求它。
由于我打开了一个终端,我做了一个简单的脚本来更改密码,并在两次按键中密码增加。
A lot of great suggestions here, I'll give the one that I found the most efficient:
Just change your password in the site. The old authentication will became outdated and Chrome will request it again.
Since I had a terminal open, I did a simple script to change the password and in two keypresses it were incremented.
您将在 chrome 中看到弹出窗口
勾选以上选项并单击清除数据即可完成。
You will see popup in chrome
Check the above options and click clear data and you are done.
我使用的是 Chrome 75。我发现重新启动 Chrome 不起作用。但重新启动 Chrome 并打开开发者工具确实有效。我没有任何解释为什么会这样。
I'm using Chrome 75. What I've found is that restarting Chrome doesn't work. But restarting Chrome AND opening the developer tools does work. I don't have any explanation why this should be.
就我而言(Win Chrome v100),它在使用 https://@domain.com 删除凭据时起作用。在开发工具中进行验证并查询
document.URL
。In my case (Win Chrome v100) it worked when using
https://@domain.com
to delete the credentials. Verify in the dev tools and queryingdocument.URL
.从 这个答案,我发现我可以打开 Chrome 开发工具 (Ctrl+Shift+I),并将以下内容粘贴到控制台:
页面将刷新,凭据将被清除。
From this answer, I worked out I could open Chrome Dev Tools (Ctrl+Shift+I), and paste the following into the console:
The page will refresh, and the credentials will be cleared.
在 Chrome 中,当您访问受密码保护的 URL 时,在 URL 栏的右侧,您应该会看到一个小钥匙符号。单击该符号,您将直接进入密码管理区域,您可以在其中删除该条目。这将确保您将来收到提示或有机会输入新密码并保存。
如果您没有看到钥匙符号,可以通过转到 Chrome -> 来访问相同的密码管理区域。设置->密码和表格 ->管理密码。或者更简单地说,这个 URL – chrome://settings/passwords。
In Chrome, on the right-hand side of the URL bar when you are at a password protected URL, you should see a small key symbol. Click the symbol and it will take you directly to the Password Management area where you can remove the entry. That will ensure you receive future prompts or have an opportunity to enter a new password and save it.
If you do not see the key symbol, that same Password Management area can be accessed by going to Chrome -> Settings -> Passwords and forms -> Manage Passwords. Or more simply, this URL – chrome://settings/passwords.
对于 Chrome 66,我在以下位置找到了相关选项:
使用新的隐身窗口可能更容易,但对于您忘记并想要清除的情况保存的密码,无需重新启动 Chrome 即可完成此操作(这也有效)
For Chrome 66 I found the relevant option under:
Using a new Incognito window is probably easier, but for those times you forget and want to clear the saved password, this does the trick without having to restart Chrome (which also works)
对于 Windows 10:对我有用的是清除凭据管理器中 Windows 凭据中的凭据。
For Windows 10: What worked for me was clearing the credentials in the Windows Credentials in the Credential Manager.
我使用 LastPass 密码管理器,删除 LastPass 中的凭据解决了该问题。
I was using LastPass password manager, deleting credentials in LastPass solved the issue.
最奇怪的是,但就我而言,我试图访问具有基本身份验证的页面,而 Chrome 甚至在没有提示的情况下发送了无效的凭据。当我退出 LastPass 插件后,一切都恢复正常。所以我认为 LastPass 开始支持基本身份验证,但它没有提供使用密码的选项,它看起来只是为匹配的域发送随机密码(这在我的情况下是非常有问题的)。
认为这可能对某人有帮助。
Weirdest thing, but in my case, I was trying to access a page with basic auth and Chrome was sending invalid credentials without even prompting for it. After I logged out from my LastPass plugin, everything was back to normal. So I think LastPass is starting to support Basic Auth but it's not giving the option of what password to use, it looks like it's just sending a random password for a domain that matches (which is very problematic in my case).
Thought it might help someone.
唯一对我有用的就是向我的应用程序添加一条路由,该路由将用户注销并返回 401 Http 错误。
在 Laravel 中,看起来
我可以加载此路由,并且下次访问常规路由时会提示输入基本凭据。
The only thing that worked for me was to add a route to my application that logs the user out and returns a 401 Http error.
In Laravel, this looked like
I can load this route and next access to the regular routes are prompted for the basic credentials.
Chrome 使用与 IE 相同的Internet 选项。
尝试打开您的Internet 选项并从“受信任的站点”中删除该 URL。当您重新启动浏览器并再次访问该 URL 时,这应该会重新生成 401 凭据调用。
您可能还需要将其从“Intranet 站点”中删除。
Chrome uses the same Internet Options as IE.
Try opening your Internet Options and removing the URL from "Trusted Sites." This should regenerate a 401 call for credentials when you restart the browser and visit the URL again.
You may need to remove it from "Intranet Sites" as well.
自从答案发布以来,情况发生了很大变化。
现在您将在地址栏右侧看到一个小钥匙符号。
单击该符号,您将直接进入已保存的密码对话框,您可以在其中删除密码。
在 Chrome 49 中测试成功
Things changed a lot since the answer was posted.
Now you will see a small key symbol on the right hand side of the URL bar.
Click the symbol and it will take you directly to the saved password dialog where you can remove the password.
Successfully tested in Chrome 49
服务器端解决方案
如果您想提示用户注销,您只需发送带有 401 状态代码的 HTTP 标头即可。 具体操作方法如下:
或者,您可以在 HTTP 响应正文中包含元刷新,以在注销后将用户重定向回主页:(
/ 是您的主页,5 是 5 秒延迟)
其中 解决方案
要清除已保存的基本身份验证凭据,您可以发送新的 AJAX 向服务器发出请求,步骤如下:
这里,“LTop”是 Base64 编码的字符串,可能包含无效的身份验证数据。
2. 准备 URL:获取完整的 URL,包括协议、域和路径,并在协议和域之间插入新的身份验证部分。例如,如果您的域名是
https://yourdomain.com
,则准备好的 URL 将为https://-:)@yourdomain.com
。发送此请求后,浏览器应该忘记旧的凭据,以便您刷新页面。
替代解决方案#1
另一种方法是关闭所有浏览器选项卡和窗口,然后重新打开浏览器。这应该会再次触发身份验证提示。
替代解决方案#2
另一种选择是使用隐身窗口。但是,如果您已经通过现有的隐身窗口登录,则此操作将不起作用。在这种情况下,请关闭所有隐身窗口,然后打开一个新窗口。
Server-Side solution
If you'd like to prompt the user to log out, you can simply send an HTTP header with a 401 status code. Here's how you can do it:
Optionally, you can include a meta-refresh in the HTTP response body to redirect users back to the main page after logging out:
(where / is your main page and 5 is 5 seconds delay)
Client-Side solution
To clear the saved Basic Auth credentials, you can send a new AJAX request to the server with the following steps:
Here, "LTop" is a Base64-encoded string that may contain invalid authentication data.
2. Prepare the URL: take your complete URL, including the protocol, domain, and path, and insert a new authentication part between the protocol and domain. For instance, if your domain is
https://yourdomain.com
, the prepared URL would behttps://-:)@yourdomain.com
.After sending this request, the browser should forget the old credentials, allowing you to refresh the page.
Alternate Solution #1
An alternative approach is to close all of your browser tabs and windows, then reopen the browser. This should trigger the authentication prompt again.
Alternate solution #2
Another option is to use an incognito window. However, this won't work if you've already logged in via an existing incognito window. In that case, close all incognito windows and then open a new one.
我很惊讶没有人提到这一点,但实际上可以从这里删除
基本 HTTP 身份验证
凭据:chrome://password-manager/passwords
然后你只需要重新启动你的浏览器来修复它。
我刚刚在运行 Chrome
124.0.6367.78
的 Windows 11 上进行了测试,我确认它运行良好。I'm surprised nobody mentioned this but
Basic HTTP authentication
credentials can actually be deleted from here:chrome://password-manager/passwords
And then you just need to restart your browser to fix it.
I just tested on Windows 11 running Chrome
124.0.6367.78
and I confirm that it works perfectly.您还可以通过设置页面 chrome://chrome/settings
然后单击链接
管理保存的密码
。You can also do it via the settings page, chrome://chrome/settings
Then click the link
Manage saved passwords
.您应该能够通过 chrome://settings/advanced 中的“清除浏览数据...”从浏览器中清除您的凭据
You should be able to clear your credentials from your browser via "Clear Browsing Data..." in chrome://settings/advanced