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

Omda's avatar
Level 1

User login from different location or device

I need to implement authentication once the user login to my app from a different location or different device my app send verification message mail, so I am thinking to add two fields [current_device, current_location] to the user profile, so I wonder is this the best way to do it?

If not what is the best way and best practice to implement it?

0 likes
3 replies
Snapey's avatar

@towfiq046 The correct approach is to send a cookie to the device, then later if the user logged in and that cookie is not present then you do the extra authentication

Please or to participate in this conversation.