Hello everyone,
I am struggling with the signed validation of email validation routes through API.
We have a VueJS frontend and a Laravel backend.
When a user registers through the frontend, the backend generates a VerifyEmail notification, which contains a signed route.
We made it so the generated route, which is sent by email to the user, points to our frontend : https://frontend.com/email/verify/xxx/yyyyyy?expires=zzzz&signature=ssssssss
Our front receives that, and thus will call our backend through an API route with the same parameters :
https://backtend.com/api/auth/email/verify/xxx/yyyyyy?expires=zzzz&signature=ssssssss
I used the "absolute/relative" feature so that the domain is not taken into account during validation.
But the problem is that as we are using an API call, my URI is still different than the one sent to the user, as we have a /api/auth prefix.
And so, we calculate a signature on the front URL, but it is then checked against the api URL...
The only idea I have left is to adapt the mechanism behind VerifyEmail to calculate the signature on the API URL, then modify the URL to the frontend version before sending it to the user by email.
It should work, but I feel like butchering everything. Isn't there a built-in feature to deal with such situations ?