G
G
GrimJack2017-09-11 16:33:43
API
GrimJack, 2017-09-11 16:33:43

How to implement authorization by email password in laravel passport?

Hello everyone, I can’t figure out how to authorize a user only by email and password and give him access tokens?
In the documentation, you need to transfer a special key. But this is not included in the concept of the application and you need to log in only by email and password. How to do it? All that I found in Google is an implicit method. But it is not clear what and how should happen

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Aksentiev, 2017-09-11
@Sanasol

In the documentation you need to transfer a special key

are you talking about CSRF token? So it's for safety.
shta?
The token is hidden and secretly transferred automatically, where does the concept come from?
https://laravel.com/docs/5.5/passport#password-gra...

R
Roman Sokharev, 2018-01-31
@greabock

auth()->once($credentials);
$token = auth()->user()->createToken('Token Name')->accessToken;

This is, briefly and literally, what you asked for.
And if it is correct, then there is a password grant for this, which you can read about in the
corresponding section of the documentation

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question