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
2
Answers
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 usenone
ornull
don’t forget to use
lax
orstrict
in productionprobably 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