Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

laravel007's avatar

Email validation in API.

Hello

I am developing API where user need to verify email's ownership. But when I put the endpoint in api.php file that need access token in every request. I need this url need to be accessible publicly and user will click from email link to verify.

Here is my url- api.php

Route::get('/activate-managers/{hash}', 'ShopOwnerController@activateManager');

Now when I click in the link of my email, it shows me unauthenticated issue.

How to solve this issue?

0 likes
4 replies
tisuchi's avatar
tisuchi
Best Answer
Level 70

I believe in that case, you need to put your activate-manager route code in web since you are trying to access this via web browser.

3 likes
laravel007's avatar

@TISUCHI - Do you mean defining routes in the web like this way?

web.php

Route::get('/activate-pending-managers/{hash}', 'ShopOwnerController@activateManager');

But do you think it's save?

1 like
tisuchi's avatar

@LARAVEL007 - Yes, that's what I mean.

Security shoudn't be the biggest concern here because you are just getting a hash to cross-check with DB and then update the data, nothing else.

3 likes

Please or to participate in this conversation.