用户图像“显示URL”当我使用firebase进行身份验证时,在UI上显示不正确

发布于 2025-02-10 18:29:40 字数 2544 浏览 0 评论 0原文

注意:基于电子邮件password的登录工作正常工作才能在使用Google登录时发生。

    <li onClick={() => setShow(!show)} className="nav-item cursor-pointer relative">
        <div className="flex items-center gap-3">
            <img className="w-14 h-14 rounded-full border p-1" src={user?.photoURL} alt="" />
         </div>
          {show && (
             <ul className="absolute top-[70px] left-0 sm:left-auto sm:right-0">
               <div className="rounded shadow bg-white " data-bs-popper="none">
                   <div className="w-[240px] p-5">
                       <div className="pb-0">
                         <div className="flex py-1 items-center gap-2">
                             <img className="rounded-full w-10 h-10" src={loading ? "Loading" : user?.photoURL} alt="profile" />
                             <div className="flex-fill ms-3 ">
                                <h4 className="font-bold">{loading ? "Loading" : user?.displayName}</h4>
                                 <small className="">{user?.email}</small>
                             </div>
                          </div>
    
                          <div>
                             <div className="border-b-2 my-3" /></div>
                          </div>
                     <div className="list-group m-2 flex flex-col gap-3">
                   <Link to="/my-profile" className="text-lg">
                   <FontAwesomeIcon className="mr-3" icon={faUser} /> Profile Page
                  </Link>
                  <Link to="/my-inventories" className="text-lg">
                  <FontAwesomeIcon className="mr-3" icon={faFileInvoice} /> My Inventories
                  </Link>
                  <Link onClick={() => signOut(auth)} to="/login" className="text-lg">
                  <FontAwesomeIcon className="mr-3" icon={faSignOut} /> Sign Out
              </Link>
           </div>
      </div>
  </div>
</ul>
 )}
</li>

查看UI “查看UI上发生的事情”

即使IMG也获得了Google用户映像。 屏幕截图。”

Note: email-password-based login working properly only happened when login using google.

    <li onClick={() => setShow(!show)} className="nav-item cursor-pointer relative">
        <div className="flex items-center gap-3">
            <img className="w-14 h-14 rounded-full border p-1" src={user?.photoURL} alt="" />
         </div>
          {show && (
             <ul className="absolute top-[70px] left-0 sm:left-auto sm:right-0">
               <div className="rounded shadow bg-white " data-bs-popper="none">
                   <div className="w-[240px] p-5">
                       <div className="pb-0">
                         <div className="flex py-1 items-center gap-2">
                             <img className="rounded-full w-10 h-10" src={loading ? "Loading" : user?.photoURL} alt="profile" />
                             <div className="flex-fill ms-3 ">
                                <h4 className="font-bold">{loading ? "Loading" : user?.displayName}</h4>
                                 <small className="">{user?.email}</small>
                             </div>
                          </div>
    
                          <div>
                             <div className="border-b-2 my-3" /></div>
                          </div>
                     <div className="list-group m-2 flex flex-col gap-3">
                   <Link to="/my-profile" className="text-lg">
                   <FontAwesomeIcon className="mr-3" icon={faUser} /> Profile Page
                  </Link>
                  <Link to="/my-inventories" className="text-lg">
                  <FontAwesomeIcon className="mr-3" icon={faFileInvoice} /> My Inventories
                  </Link>
                  <Link onClick={() => signOut(auth)} to="/login" className="text-lg">
                  <FontAwesomeIcon className="mr-3" icon={faSignOut} /> Sign Out
              </Link>
           </div>
      </div>
  </div>
</ul>
 )}
</li>

see what what happened on UI see what happened on ui

Even img get the google user image. see the screenshot.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七堇年 2025-02-17 18:29:40

我大约一个月迟到,但我认为我发现答案

与图像的参考政策有关。

因此,在图像中添加referrerpolicy =“ no-the Referrer”

希望这能解决您的问题。

I'm approx. a month late but I think I found the answer

I thinks it's related to the reference policy of the image.

So add referrerpolicy="no-referrer" inside the image.

Hope this fixes your problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文