jeudi 25 juin 2020

Url for API to login and get access token

I want to validate the email and password of someone connecting through an API.

The idea is that they login through POST to site.com/api/v1/token?email=foo@bar.com&password=foobar

I was reading that best practices should be to make a https://laravel.com/docs/7.x/validation#creating-form-requests to handle the validation, but I couldn't understand how to validate the $user, because when I created the new Class there wasn't any request there.

I'm not sure if I'm missing something. I was able to do it through the Controller just checking if the user exists and the password is valid.

The app would ping this URL with email/password, then get a Token as a response with the $user information and use this token to post/edit/delete other data



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2B0Zyyg
via IFTTT

Aucun commentaire:

Enregistrer un commentaire