API Use Basic Auth to Get Access Token

I'm working on an internal app to download the artifacts and also see the build status.

I would like to avoid basic auth for all the api and only restrict it for login.

So when i login i will use basic auth and fetch access tokens and if there is an access token for my app exist, i will store it locally and use it for rest of the api calls.

If the access token is not there, i'll trigger an api call to create one.

The issue i'm having is the api to get tokens doesn't provide the actual token.  Is there an api to get the actual access token using basic auth ?

Thank you in advance,

 

 

 

 

1 comment
Comment actions Permalink

Hi Thilek,

There are three options for access token management from REST API. As found in our documentation (https://www.jetbrains.com/help/teamcity/2019.1/rest-api.html#RESTAPI-UserAccessTokens), you can use the following with httpAuth to list existing tokens, create new tokens, and delete existing tokens.

List of access tokens: GET http://teamcity:8111/httpAuth/app/rest/users/<userLocator>/tokens.

Create an access token: POST http://teamcity:8111/httpAuth/app/rest/users/<userLocator>/tokens/<tokenName>.

Delete an access token: DELETE http://teamcity:8111/httpAuth/app/rest/users/<userLocator>/tokens/<tokenName>.

It is important to note that the only time you will be presented with the actual token is when it is created. It will not be displayed or available for viewing in the future, so it is important to store it in a secure location or just create a new one each time.

0

Please sign in to leave a comment.