Email verification (Laravel) 403 Invalid Signature

agentaldoPRO

8 months 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-ledesmaHOBBY

3 months ago

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


agentaldoPRO

3 months 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-ledesmaHOBBY

3 months 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


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

agentaldoPRO

3 months 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-ledesmaHOBBY

3 months ago

Do you mean the region in settings?


agustina-ledesma

Do you mean the region in settings?

agentaldoPRO

3 months 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-ledesmaHOBBY

2 months 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 :(

agentaldoPRO

2 months 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-ledesmaHOBBY

2 months ago

gracias !! <3


agustina-ledesma

gracias !! <3

agentaldoPRO

2 months 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-ledesmaHOBBY

2 months 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 2 months ago


Email verification (Laravel) 403 Invalid Signature - Railway Help Station