-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 trying to create a token via curl #174
Comments
The request needs to be of content type |
curl automatically sets that when using With
|
A right sorry, I missed that you are setting client id and client secret as post parameters. This is not supported, please use basic authorization |
This is per spec. The rationale is usually that authorization headers are truncated from logs, while post bodies might not. |
Awesome, thanks @arekkas. It would seem that a lot of oauth 2 apis out there use form encoding, but I do like the idea of using the authorization header. This ended up working fine: curl -k -X POST -d grant_type=client_credentials -d scope=core -u '886781ac-9095-4aae-887e-373182d468f6:XXXXX' https://localhost:4444/oauth2/token Thanks again! |
Yup that's part of why I wrote hydra. A lot of people are not following the spec 100%, which in turn needs hacks like https://github.com/golang/oauth2/blob/master/internal/token.go#L92-L147 in oauth2 libraries! |
I can use CLI to obtain access token but when I do curl, I always get "connection refused" error. Here is what I executed locally.
curl: (7) Failed to connect to localhost port 4444: Connection refused If I do the following cmd via cli it works fine:
|
I made it correct myself. The error is because I started the container without mapping to the port 4444 on the host. Adding -v to curl command tells me the issue. |
I'm trying to create a token and I'm using curl to try and build what the request should look like and can't get a working example. Here's the command that I'm executing:
curl -k -X POST -d grant_type=client_credentials -d client_id=886781ac-9095-4aae-887e-373182d468f6 -d 'client_secret=XXXXXXXX' -d scope=core https://localhost:4444/oauth2/token
And this is the response I get back:
That response doesn't give me anything particularly useful to debug further, and the hydra logs don't seem to shed any more light on what is wrong about my request.
Thanks for the project - I love the niche it fills and would really like to get this working!
The text was updated successfully, but these errors were encountered: