Email verification (Laravel) 403 Invalid Signature
agentaldo
PROOP

a year ago

I have my Laravel app working correctly except for the email verifier when a user registers it sends an email with the verification link like the following

https://my-domain.com/verify-email/1/661b90ddc6789cc36c41e7db16e25a717fcf23fc?expires=1626719702&signature=33g6c06b3e6c0da8a492250749be77de062e36ba3f14b73ffbc5866e30de2238

but when accessing the link it generates error 403 Invalid Signature

I have already verified the environment variables, and everything seems to be fine, in my local environment it works perfectly.

Does anyone know why it doesn't work?

Closed

11 Replies

agustina-ledesma
HOBBY

a year ago

Hi did you find the solution? I have the same problem.


agentaldo
PROOP

a year ago

Hello,

The first thing I did was to verify that in the .env file the APP_URL variable is correctly defined with https

APP_URL="https://my-domian.com"

and that this URL is the same as the one that is arriving in the verification email

Second, the use of https must be forced in the AppServiceProvider file boot() method you must have the following

if ($this->app->environment('production')) {

URL::forceScheme('https');

}


agentaldo

Hello,The first thing I did was to verify that in the .env file the APP_URL variable is correctly defined with httpsAPP_URL="https://my-domian.com"and that this URL is the same as the one that is arriving in the verification emailSecond, the use of https must be forced in the AppServiceProvider file boot() method you must have the followingif ($this->app->environment('production')) {URL::forceScheme('https');}

agustina-ledesma
HOBBY

a year ago

Hello, yes I have tried it, also with: protected $proxies = '*'; but I still have the same error. I don't know what it could be. Thanks grinning emoji


agustina-ledesma

Hello, yes I have tried it, also with: protected $proxies = '*'; but I still have the same error. I don't know what it could be. Thanks

agentaldo
PROOP

a year ago

You have also verified that the time zone is correct, this may be affected by the expiration time generated by the email verification token.


agentaldo

You have also verified that the time zone is correct, this may be affected by the expiration time generated by the email verification token.

agustina-ledesma
HOBBY

a year ago

Do you mean the region in settings?


agustina-ledesma

Do you mean the region in settings?

agentaldo
PROOP

a year ago

Yes, if the server time is out of date, the URL may expire prematurely. Check the time on the server and the environment variable

APP_TIMEZONE


agentaldo

Yes, if the server time is out of date, the URL may expire prematurely. Check the time on the server and the environment variableAPP_TIMEZONE

agustina-ledesma
HOBBY

a year ago

yes I also checked, sadly it doesn't work for me. I still get a 403 error :(


agustina-ledesma

yes I also checked, sadly it doesn't work for me. I still get a 403 error :(

agentaldo
PROOP

a year ago

At the time I had that error, those were the things I checked to fix it, if you want us to check to try to find the problem you can write to me at this email urielalejandro.lp@gmail.com


agentaldo

At the time I had that error, those were the things I checked to fix it, if you want us to check to try to find the problem you can write to me at this email urielalejandro.lp@gmail.com

agustina-ledesma
HOBBY

a year ago

gracias !! <3


agustina-ledesma

gracias !! <3

agentaldo
PROOP

a year ago

What version of Laravel do you have?
Oh by the way, can you share your bootstrap/app.php file here so we can see how you have it configured, and?


agustina-ledesma
HOBBY

a year ago

I added HTTPS true, in addition to forcing the url, and it seems to work fine.

if (env('APP_ENV') === 'production') {

URL::forceScheme('https');

$this->app['request']->server->set('HTTPS', true) ///here ;

}


Status changed to Closed brody 12 months ago


Loading...