authentication - Telegram 登录小部件因禁用跨站点 cookie 而损坏

不久前,大多数浏览器都禁止第三方 cookie,这破坏了我的 Telegram 用户授权流程。例如,启用 Prevent cross-site tracking 选项(默认情况下),在 Telegram 窗口中授权登录后,我的网站上没有任何反应(对 telegram OAuth 的请求失败,显示 NOT_AUTHORIZED 原因)。在我的浏览器中关闭跨站点跟踪是可行的,但这对我网站的访问者来说并非易事。

有什么方法可以解决较新浏览器上 Telegram 登录小部件的问题吗?

最佳答案

<script async src="https://telegram.org/js/telegram-widget.js?15" 
              data-telegram-login="Anonymousairiv3Bot" 
              data-size="large" 
              data-onauth="onTelegramAuth(user)" 
              data-request-access="write">
</script>

<script type="text/javascript">
   function onTelegramAuth(user) {
      alert('Logged in as ' + user.first_name + ' ' + user.last_name + ' (' + user.id + (user.username ? ', @' + user.username : '') + ')');
   }
</script>

https://stackoverflow.com/questions/64483504/

相关文章:

reactjs - React craco tailwind postcss 集成

docker - 使用 .Net Core 3.1 api (docker) 运行 Heroku 时

reactjs - 如何使用代理将 Flask API 和 React 前端微服务部署到 Googl

java - 修改 tomcat 上静态 Assets 的 header cookie 并使用 ap

python - pygame双显示器和全屏

python - 如何为带有输入的代码编写单元测试 (Python)

html - 输入类型 "email"在:focus state时变为 "text"

reactjs - Stripe 参数_invalid_integer

graphql - 在 Gatsby 上渲染 Contentful Reference (many)

git - 无法推送到 bitbucket 403 "authentication failed"