Hello anonymous user, you can use MS Graph List signIns operation. Records will be returned only for users that have logged in at least once. You can check the status property to get more information in case of an error.
Below you will find some samples:
Get latest sign in by user id:
https://graph.microsoft.com/v1.0/auditLogs/signins?$top=1&$filter=userId eq '<USER OBJECT ID>'
Get latest sign in by user upn:
https://graph.microsoft.com/v1.0/auditLogs/signins?$top=1&$filter=userPrincipalName eq '<USER UPN>'
Let us know if this answer was helpful to you or if you need additional assistance. If it was helpful, please remember to accept it and complete the quality survey so that others in the community with similar questions can more easily find a rated solution.