Curl: (6) Could not resolve host - Request tokens

Hi Auth0 developers,

I followed the first sample file from your web link:
https://auth0.com/docs/flows/call-your-api-using-resource-owner-password-flow#example-post-to-token-url

Then modified with my specific data and I executed the following: (I use the Git Bash)

$ cat curl.token1
curl --request POST
–url ‘https://dev-wvhl4zor.us.auth0.com/oauth/token
–header ‘content-type:application/x-www-form-urlencoded’
–data grant_type=http://auth0.com/oauth/grant-type/password-realm
–data username=myemail@xyz.com
–data password=mypassword
–data audience=https://dev-wvhl4zor.us.auth0.com/api/v2/
–data scope=openid profile email
–data ‘client_id=1CYxxxxxxxxxxxxxxxxxxxxxxxxSn’
–data client_secret=tYrxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxYu

But I could not get any data in the output like below :

$ curl -v curl.token1
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0* Could not resolve host: curl.token1

  • Closing connection 0
    curl: (6) Could not resolve host: curl.token1

My goal is to get an id_token for my application in Auth0 via curl.

Could you please help to take a look and see what it maybe wrong or there is other curl command to make it work? A working example would be much appreciated.

Thank you.

Hey @susan.zheng , looks like the curl command is picking up the wrong hostname , it should pick the hostname as dev-wvhl4zor.us.auth0.com, but seems to be some issue there. Just a quick question why do you have : cat curl.token1 in the request?

Regards,
sidharth

1 Like

Hi sidharth,

Thank you for looking into this. I use the “git bash” to run the curl script which was saved in a file named “curl.token1”. “cat” is a linux command to read that file.

My actual command to run the curl script is like below:

$ curl -v curl.token1
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0* Could not resolve host: curl.token1

  • Closing connection 0
    curl: (6) Could not resolve host: curl.token1

I wonder how to let the curl pick up the proper hostname such as " dev-wvhl4zor.us.auth0.com" here?

Thank you!

@susan.zheng , Not sure of the exact syntax here, but have you tried the curl directly with your POST request?

1 Like