Using 'Basic' Authentication in CircleCI API Calls

Basic Authentication

You can use Basic Authentication for our CircleCI V2 APIs:

https://circleci.com/docs/api/v2/#section/Authentication/basic_auth

Please note that this would require you to:

  • set the username value to your CircleCI user API token, and
  • (optional) set the password as empty

 

Examples

The following examples use `curl` , but you can adjust according to your HTTP library.

curl -X GET -u "${CIRCLE_TOKEN}:" https://circleci.com/api/v2/me

 

BASIC_AUTH=$(echo -n "${CIRCLE_TOKEN}:" | base64)

curl -H "Authorization: Basic ${BASIC_AUTH}" https://circleci.com/api/v2/me

 

# example without setting password for Basic Authentication
# Note the `:` is not set here
curl -H "Authorization: Basic $(echo -n $CIRCLE_TOKEN | base64)" https://circleci.com/api/v2/me
Was this article helpful?
10 out of 18 found this helpful

Comments

0 comments

Article is closed for comments.