A
A
Artem00712018-02-04 14:37:18
Laravel
Artem0071, 2018-02-04 14:37:18

How to register a user through Passport?

I'm using Passport in Laravel as API
Front on Vue (as a standalone application)
How do I register and then login?
Those, I know that in order to register a user, you should send an email and a password to the controller and it will be created there
And I know that in order to enter (via Passport), you need to pass email, password, client_id, secret and then I will receive a user token
But how to get this token when creating a user?
That is, when a user is created, then a token is immediately created there?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Kuznetsov, 2018-02-05
@Artem0071

When you have passed the first stage of installation and configuration https://laravel.ru/docs/v5/passport , then tables are created in the database. In one of them (I don’t remember what it’s called, there are 2 entries) there are keys. Use the 2nd key when sending data during authorization. And then, after authorization, in response, you are given a secret_key, which you use further to work with the application.
Registration is done in a simple way. Only for the registration route, do not expose the middleware - api, otherwise you will not be able to register users.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question