Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

register new user from api route using laravel passport

Tags:

I have installed laravel 5.3 and passport pakage. I followed the documentaition step by step I can use the following route POST /oauth/token with the following parameters

  1. username
  2. password
  3. client_secret
  4. grant_type
  5. client_id

and I get the following response

{
  "token_type": "Bearer",
  "expires_in": 31536000,
  "access_token": "access token here",
  "refresh_token": "refresh token here"
}

then I request GET /api/user

with the following header

  1. Authorization = "Bearer access token here"
  2. accept = application/json (optional)

and this is work fine and so all apis.

the problem I have is the user who I authinticated and entered his username and password in the first request and return me back the access token is a user I have created from laravel web view /register

How can I create new user or register new user from the api route file

like POST /api/register

the user at first time need to register to be authinticated after that.

Should I create this route without oauth to register then if success the registration he request POST /oauth/token to be authinticated or what? Am I missing something ??

update the clent_secret is it right to be constant in all users requests or each user should have diffrent clent_secret, and if it is how to create aclent secret if it neaded to authinticate user ?