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

error on mismatch uris #569

Closed
sredxny opened this issue Aug 16, 2017 · 2 comments
Closed

error on mismatch uris #569

sredxny opened this issue Aug 16, 2017 · 2 comments

Comments

@sredxny
Copy link

sredxny commented Aug 16, 2017

Hi, I am having an error and I wasn't able to get what is wrong, as the message showed in docker logs seems to not makes senses at all. Currently I have hydra and the consent app running in the cloud, now am trying to consume them from my local in a Golang Application, so, I registered a user only for it with this description:

id: local-consumer
client_name: local-consumer
client_secret: somesecret
redirect_uris: http://localhost:9999/callback
grant_types: client_credentials|authorization_code|refresh_token|client_credentials|implicit|
response_types: token|code|id_token
scope:: openid offline hydra.clients hydra.clients hydra.keys.get

Now, from my local golang app I have this to connect to hydra (and it's connecting successful):

if client, err = sdk.Connect(
		sdk.Scopes("hydra.keys.get"),
		sdk.SkipTLSVerify(),
		sdk.ClientID(env.Getenv("HYDRA_CLIENT_ID", "local-consumer")),
		sdk.ClientSecret(env.Getenv("HYDRA_CLIENT_SECRET", "somesecret")),
		sdk.ClusterURL(env.Getenv("HYDRA_CLUSTER_URL", TheURLinTheCloud)),
	); err != nil {
		log.Fatalf("Could not connect to Hydra because: %s", err)
	}

Somehow, when I attempt to login from my local using hydra I get:

Could not exhange token: oauth2: cannot fetch token: 400 Bad Request
Response: {"error":"invalid_request","error_description":"The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed","statusCode":400}

The link that I used to attempt the login was:
https://TheURLinTheCloud.com/oauth2/auth?client_id=local-app&redirect_uri=http%3A%2F%2Flocalhost%3A9999%2Fcallback&response_type=code&scope=offline+openid&state=demostatedemostatedemo&nonce=demostatedemostatedemo

Then, I went to the server and check the logs, this is what I have:

time="2017-08-16T01:37:48Z" level=info msg="started handling request" method=POST remote=186.93.226.189 request="/oauth2/token"
time="2017-08-16T01:37:48Z" level=error msg="An error occurred" error="Redirect URI mismatch: The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed"
time="2017-08-16T01:37:48Z" level=info msg="completed handling request" measure#https://somethings.com.latency=146632466 method=POST remote=xxx.xxx.xxx.xxx request="/oauth2/token" status=400 text_status="Bad Request" took=146.632466ms

So, basically:

  • In the database the URI is localhost:9999/callback

  • In the URL I specify as callback url: localhost:9999/callback

Then, why am receiving that message? or what other things can cause this error?
Thank you in advance

@aeneasr
Copy link
Member

aeneasr commented Aug 16, 2017

Maybe you're using the wrong client id? One time you have local-consumer but in the request I see ?client_id=local-app

@aeneasr
Copy link
Member

aeneasr commented Sep 5, 2017

Closing due to inactivity

@aeneasr aeneasr closed this as completed Sep 5, 2017
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