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_basic fails when client_secret is auto-generated #1419

Closed
leovingi opened this issue May 2, 2019 · 5 comments
Closed

client_secret_basic fails when client_secret is auto-generated #1419

leovingi opened this issue May 2, 2019 · 5 comments

Comments

@leovingi
Copy link

leovingi commented May 2, 2019

Describe the bug
I have 2 clients - one with a client_secret I passed to the registration endpoint and one without. Hydra gives the latter an automatically generated client_secret.
I've gone through the OAuth2 flow with the 2nd client, received a code but when trying to exchange it for a token, it fails with the message
"crypto/bcrypt: hashedPassword is not the hash of the given password"

If I repeat the same process with the 1st client I set up, it all works fine. client id and secret are both percent-encoded, then base64'ed, nothing else changes in the process.

I suspect it might have something to do with the characters in the secret, but not sure.

To Reproduce
Steps to reproduce the behavior:

  1. Create a client without a client_secret, get it generated automatically. Set the auth method to client_secret_basic
  2. Go through the authentication flow - /oauth2/auth?client_id=12345&response_type=code&state=.....
  3. Get the code
  4. Try and exchange the code for a token, setting the appropriate Authorization header

Expected behavior
Should receive an access_token, but instead it fails with an error.

Version:

  • Environment: Hydra Binary, Linux 64-bit
  • Version v1.0.0-rc.10
@aeneasr
Copy link
Member

aeneasr commented May 2, 2019

Please add steps to reproduce this (e.g. CURL, hydra ...). The most likely issue is a wrong secret.

@leovingi
Copy link
Author

leovingi commented May 2, 2019

Correct me if I'm wrong, but is the secret in the DB encrypted? Because if so, that is definitely the issue.

@aeneasr
Copy link
Member

aeneasr commented May 2, 2019

It's hashed

@leovingi
Copy link
Author

leovingi commented May 2, 2019

Is it mentioned anywhere how it's hashed or how to decrypt it?

@aeneasr
Copy link
Member

aeneasr commented May 2, 2019

You can not un-hash something. The generated secret is returned in the payload when you create the client.

@aeneasr aeneasr closed this as completed May 2, 2019
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