简体   繁体   中英

Safari and Laravel - Mail Verification

Background Story

I've been developing a Laravel application for about a month now. During the development I've only used google chrome for testing the application. The project makes use of Laravels mustverify to verify the users email. This works flawless in google chrome, however, when I switched to my MacBook, using safari, things got ugly.

The Problem

When I get the mail from the application to my mail-client, I usually just click the link "Verify Email Address" shown below. However, this just does not work in Safari. Normally I get sent to the user-panel as a verified user (in google chrome), but in Safari, I get redirected to the login-page (not verified or "logged in"), as of if the session does not exist in the safari browser.

验证电子邮件的图片

So what have I tried?

  • Try another browser on my Mac: Downloaded google chrome, works just fine.
  • Spent a few hours on reading the documentation of the Auth process of Laravel.

I also read this post that says that Safari requires a "www." in front of the url to make it understand. But how would I achieve this in a localhost?

So now I'm reaching out to you for tips, thoughts or ideas. I will list some information below that might be relevant:

  • PHP version: 7.3.24
  • Laravel Version: 8.20.1
  • Software Stack: LEMP & LAMP (running both on different machines to test)
  • Safari Version: 14.0.2

The error was that Safari did not trust the links that mailtrap provided me with. When switching to a normal mail client, everything works fine.

Edit your session.same_site config to use none or null

don't forget to use lax or strict in production

probably a Safari Bug... but this is how I fixed it...

I've provided an answer here also...

https://laracasts.com/discuss/channels/laravel/laravel-8-email-verification-not-working-with-different-browsers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM