Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot authenticate user from ZFC user table #3

Open
DevDev1 opened this issue Jun 27, 2015 · 3 comments
Open

Cannot authenticate user from ZFC user table #3

DevDev1 opened this issue Jun 27, 2015 · 3 comments

Comments

@DevDev1
Copy link

DevDev1 commented Jun 27, 2015

Hi, just trying your module and have few quesions.

I set up Apigility, and oAuth2.
I can make POST to /oauth

{"grant_type":"password", "username":"testuser", "client_id":"testclient2", "password":"testpass" }

('testuser' is stored in oauth tables - oauth_users) and got response:

{"access_token":"e59610ddeab7dd559bcea5e25e46092c7d8f25b1","expires_in":3600,"token_type":"Bearer","scope":null,"refresh_token":"10e6a1769bd133bb766bd87fdea5d86e51d4af1a"}

I believe oauth as is - is working.
I installed zfc user tested /user/login (sing up, login, logout - everything works)

Now I installed LdcZfcUserOAuth2 module, config it by instruction

  • in \vendor\zfcampus\zf-oauth2\config\module.config.php - I added in 'zf-oauth2' => array

'zf-oauth2' => array(
'storage' => 'ldc-zfc-user-oauth2-storage-pdo',
'db' => array(
'dsn' => 'mysql:dbname=mydevtest;host=localhost',
'username' => 'mydevtest',
'password' => 'pass',
),

in this step I must add also 'db' because without it I got error "...configuration ['zf-oauth2']['db'] for OAuth2 is missing..."

  • From \vendor\zf-commons\zfc-user\config\ i copy file 'zfcuser.global.php.dist' to \config\autoload and renamed it to 'zfcuser.global.php' - inside that file I changed 'auth_adapters' to:

'auth_adapters' => array( 100 => 'ldc-zfc-user-oauth2-authentication-adapter-db' ),

After that I test POST to /oauth with user/pass combination from ZFCUser (user) table (created in step when testing ZFCUser's /user/login):
{"grant_type":"password", "username":"[email protected]", "client_id":"testclient2", "password":"password"}

and response is:

{"type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html","title":"invalid_grant","status":401,"detail":"Invalid username and password combination"}

If i try user/pass from oauth table it works. It seems that it does NOT look for user/pass from ZFC user table..
Any idea/hint how to solve this?

Thnx

@adamlundrigan
Copy link
Owner

I'm not sure off-hand what could cause this. There have been updates to zf-oauth2 and ZfcUser since I wrote and last used this module so something may have changed. When I get a chance I'll try setting up a new project myself and see if I can reproduce the issue you're having.

@DevDev1
Copy link
Author

DevDev1 commented Jun 29, 2015

Hi there, I think I got it.
It work - What was wrong is setting up oauth2 via Apigility admin interface - it create adapter, and I believe that was wrong. Now I set up everything manualy and it work. I can't see oauth in apigility admin and it break /user/login (with correct u/p combination it redirect to /login again and not to wellcome page), but it work - I can auth user from zfc-user table

I can share skeleton project later so you can put in as an example if you want.

Thank you for your time.

@johnsonmartin
Copy link

i run this:
http://127.0.0.19:8888/oauth

added below json in body row data:
{
"grant_type": "password",
"username": "testuser",
"password": "testpass",
"client_id": "testclient",
"client_secret": "testpass"
}

I am getting this error :

{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
"title": "invalid_grant",
"status": 401,
"detail": "Invalid username and password combination"
}

how to remove the issue, please tell me
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants