不安全登录被阻止:您无法从不安全页面获取访问令牌或登录此应用程序.尝试将页面重新加载为 https:// [英] Insecure Login Blocked: You can't get an access token or log in to this app from an insecure page. Try re-loading the page as https://

查看:59
本文介绍了不安全登录被阻止:您无法从不安全页面获取访问令牌或登录此应用程序.尝试将页面重新加载为 https://的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过使用 href 将 Facebook 身份验证 API 路由链接到按钮来实现 Passport Facebook 身份验证,例如:

I am implementing Passport Facebook Authentication by linking the Facebook Authentication API route to a button using href like:

<a href="auth/facebook">Facebook Login</a>

当我点击按钮时,它会重定向到 Facebook 身份验证页面.但是在页面上,会显示一条错误消息,内容类似于不安全登录被阻止:您无法获取访问令牌或从不安全页面登录此应用程序.尝试重新加载页面为https://"

When I click on the button, it redirects to the Facebook Authentication page. But on the page, an error message is displayed saying something like "Insecure Login Blocked: You can't get an access token or log in to this app from an insecure page. Try re-loading the page as https://"

我该如何解决这个问题?

How can I fix this issue?

推荐答案

令人惊讶的是,我一个小时前才开始尝试做同样的事情,但一直遇到同样的问题.如果您进入 FB 开发者门户并转到 Facebook 登录 下的设置,则有一个选项可以强制使用 HTTPS.

Amazingly I just started trying to do the same thing like an hour ago and have been having the same issue. If you go into the FB developer portal and go to Settings under Facebook Login there's an option to Enforce HTTPS.

进一步调查显示:

强制 HTTPS.此设置需要 HTTPS 用于 OAuth 重定向和使用 JavaScript SDK 获取访问令牌的页面.截至 2018 年 3 月创建的所有新应用程序都默认启用此设置,您应该计划迁移任何现有应用程序以仅使用HTTPS URLs 到 2019 年 3 月.大多数主要的云应用程序主机为您的应用程序提供免费和自动的 TLS 证书配置.如果您自托管您的应用程序或您的托管服务默认不提供 HTTPS,您可以为您的应用程序获取免费证书来自 Let's Encrypt 的域."

"Enforce HTTPS. This setting requires HTTPS for OAuth Redirects and pages getting access tokens with the JavaScript SDK. All new apps created as of March 2018 have this setting on by default and you should plan to migrate any existing apps to use only HTTPS URLs by March 2019. Most major cloud application hosts provide free and automatic configuration of TLS certificates for your applications. If you self-host your app or your hosting service doesn't offer HTTPS by default, you can obtain a free certificate for your domain(s) from Let's Encrypt."

参考:登录安全

这篇关于不安全登录被阻止:您无法从不安全页面获取访问令牌或登录此应用程序.尝试将页面重新加载为 https://的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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