Authentication

Obtaining API Tokens

Once registered you’ll find your API Tokens at the console.

  1. The Private Token is used for protected API requests like starting the server and managing podcasts.
  2. The Public Token is used to display widgets as the stream or podcasts player in your website.

Reset Tokens
If you believe your private token may have been compromised you can generate new one at the console, just make sure to update the new token at your application/plugin.

API Requests Authentication

Authenticating Private Requests

To authenticate your private requests, provide your private token with the request.
For a GET endpoint request, simply append the token as a URL parameter:

curl -i \
     -X GET \
     -H "Accept: application/json" \
     -H "Cache-Control: no-cache" \
     "https://hub.cloud.caster.fm/private/GET_ENDPOINT?token=PRIVATE_TOKEN"

For a POST endpoint request, include it with your POST data:

curl -i \
     -H "Accept: application/json" \
     -X POST \
     -d "{token:PRIVATE_TOKEN}" \
     "https://hub.cloud.caster.fm/private/POST_ENDPOINT"

Invalid Token Response
If the private token provided is invalid an HTTP status code 401 will be returned

Verifying The Private Token 

You can verify a private token with a GET request to the following URL:
https://hub.cloud.caster.fm/private/checkToken?token=PRIVATE_TOKEN

curl -i \
     -X GET \
     -H "Accept: application/json" \
     -H "Cache-Control: no-cache" \
     "https://hub.cloud.caster.fm/private/checkToken?token=PRIVATE_TOKEN"

If the provided private token is valid the HTTP status code will be 200 and the body will contain a JSON with the private and public token:

JSON
{
  "public_token": "97824ed0-ee56-4d2c-ba29-efbcb76794c5",
  "private_token": "a8ea3659-6989-494b-9e9a-142a5fb6f8f5"
}

Invalid Token Response
If the private token provided is invalid an HTTP status code 401 will be returned

Updated on August 17, 2023
Was this article helpful?

Related Articles