Having issues with API requests when authenticating using a domain user

Issue

I’m trying to make an API call to my Jenkins instance using my domain user but it’s failing with:

curl: (7) Failed to connect to yourdomain.com port X: Connection timed out

It mainly affects users with a “@” character.

Environment

Resolution

This is caused by the “@” character, that makes the call interpret your user’s domain as the URL to reach.

It can be fixed by replacing your call, defining the user and token as an argument.

  • Example of a command that will fail
curl http://youruser@yourdomain.com:yourtoken@jenkins.yourdomain.com/api/json
  • Example of a successful command
curl -u youruser@yourdomain.com:yourtoken http://jenkins.yourdomain.com/api/json

Have more questions?

0 Comments

Please sign in to leave a comment.