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

Client secret never validated in AuthServer? #27

Closed
fkarlsson opened this issue Mar 25, 2013 · 2 comments
Closed

Client secret never validated in AuthServer? #27

fkarlsson opened this issue Mar 25, 2013 · 2 comments

Comments

@fkarlsson
Copy link

I may be missing something obvious here, and if so I apologize. Anyways the conclusion I've come to is that the client secret is never validated in AuthServer::checkAuthorizeParams(). I've secured my API according to the tutorials linked from the readme, and it does not matter which secret I send, I can retrieve an access token either way. Is it supposed to be like that?

Problem as I see it is in the code below, from AuthServer.php:298-299

// Validate client ID and redirect URI
$clientDetails = self::getStorage('client')->getClient($authParams['client_id'], null, $authParams['redirect_uri']);

The second parameter, client secret, is null and therefore never validated.

@alexbilbie
Copy link
Contributor

The client_secret isn't verified at that stage. In the authorisation grant it is verified when the client exchanges an authorisation code for an access token.

https://github.com/lncd/OAuth2/blob/master/src/OAuth2/AuthServer.php#L377 - loads whichever grants have enabled, for example the authorisation code grant and it is verified in each grant's completeFlow() method https://github.com/lncd/OAuth2/blob/master/src/OAuth2/Grant/AuthCode.php#L62

@fkarlsson
Copy link
Author

Then where is the problem in my implementation? I use the ruby gem oauth2 to test my setup and no matter which secret I input it works. Do I need to change the grant_type that I send?

Edit: Did not see your edit! Alright, so the problem with my implementation is my getClient function which never checks for the secret. I made this mistake as it was never included in the oauth2-example-auth-server.

Thanks for the help and most of all for a great library!

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

2 participants