hasib32 / rest-api-with-lumen

Rest API boilerplate for Lumen micro-framework.
487 stars 143 forks source link

Issue to create access Token #30

Closed LordLightAngels closed 7 years ago

LordLightAngels commented 7 years ago

Hello,

first of all a lot of thanks for the tuto on devops ans this repo git; I'm trying to get an access Token with postman:

img1

If i'm right, something missing in the "headers" section. And i choose client_id "2", in reference at the table "oauth_clients" for "Password Grant Client".

What am i do wrong? Could you please help me?

Regards

hasib32 commented 7 years ago

check your username and password.

LordLightAngels commented 7 years ago

I checked; When i put a username from column 'email' in table 'user', and a password from column password in table 'user' (from seeds) i have the same issue.

hasib32 commented 7 years ago

We resolved a issue yesterday similar to you. please check out this: https://github.com/hasib32/rest-api-with-lumen/issues/28

LordLightAngels commented 7 years ago

We tried with a colleague with email an password from database. We checked for blankspace in password and client_secret but nothing...

I was wondering what's in headers? On the picture you have "2" where we have only "1" (Content-Type && application/x-www-form-urlencoded).

Is the a Authorization to fill in, in the headers part? Or something else?

hasib32 commented 7 years ago

Actually the header doesn't matter for creating access_token. can you please send me what you have in oauth_clients table? also, how you're creating the user?

LordLightAngels commented 7 years ago

Here is an json export of oauth_client table: [ {"id":"1","user_id":null,"name":" Personal Access Client","secret":"rV98PJz73JhODyoSo1IB0GCeWR0SvBGOfaGF6A7w","redirect":"http:\/\/localhost","personal_access_client":"1","password_client":"0","revoked":"0","created_at":"2017-07-27 11:34:22","updated_at":"2017-07-27 11:34:22"}, {"id":"2","user_id":null,"name":" Password Grant Client","secret":"We9YLyEk559ymTsi0tTwgFzCCVg4CywFsoPcVQU5","redirect":"http:\/\/localhost","personal_access_client":"0","password_client":"1","revoked":"0","created_at":"2017-07-27 11:34:22","updated_at":"2017-07-27 11:34:22"} ]

For the moment i have'nt created a user, i only test with the five one created with seed.

hasib32 commented 7 years ago

I guess then, you have been using wrong password. Look at the factory: 'password' => \Illuminate\Support\Facades\Hash::make('test-password'), So, use password test-password

LordLightAngels commented 7 years ago

OK works fine.... We put the hash in the password and not the test-password. thanks a lot for your time and your answers.

Regards

hasib32 commented 7 years ago

I'm glad it's working. I'm going to close the issue.