4. Authentication

These are the instructions to authenticate and consume mitigation requests((MR’s) from the NRAO ODS API. All NRAO ODS API endpoints except for health checks require an authentication token.

  1. Contact an NRAO ODS Admin to generate a client for you with appropriate scopes. Coordinate the cadence at which your token will expire with NRAO.

  2. Post your client id and client secret as form data to the NRAO ODS API to get your authentication token.

curl -X 'POST' \
  'https://ods.nrao.edu/token/' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'grant_type=client_credentials&client_id=<client_id>&client_secret=<client_secret>'

Response 200 OK

{
  "token": "EXAMPLE_TOKEN"
}

3. Pass in this bearer token to authenticate subsequent NRAO ODS API requests. If your token has expired, you will receive a 403, and can repeat step 2 to generate a new token.

curl -X 'GET' \
  'https://ods.nrao.edu/ods_data/' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <EXAMPLE_TOKEN>'