How to create an REST token from the command line
I am creating an unattended setup for HUB and other Jetbrains products. Right now I am blocked while I am trying to automate the creation of a token for the REST calls we use to configure the service.
While I am actually using Ansible, it would be of great help if you could provide examples of how to get a bearer token, given user and pass, using curl. The Hub service ID is 0-0-0-0-0 and I need to manage only Hub (i.e. no other scopes are involved)
I have the admin account and password, but try as I might, I can not get a bearer token. The closest I got was if I use the service secret of the Hub service, but then how do I get the secret?...
curl -X POST -d "client_id=0-0-0-0-0&client_secret=foobar&grant_type=password&username=admin&password=secret&scope=0-0-0-0-0" http://localhost:8082/hub/api/rest/oauth2/token
I also noticed the awcToken.properties file, but I am not sure where can I use this token and what can I do with it.
Please sign in to leave a comment.
Hi Dimitar,
you can use basic authorization. You need to create a token like this:
and the request would be:
For example:
Please let us know if you have any further questions. Thanks!
Thank you! You may want to add this tip (that basic auth works) to the REST API help page.