/token EndpointThe /token endpoint in the Podcast Performance Server is used to generate tokens that are crucial for various functionalities within the Podcast Performance system. This document provides an overview of the endpoint and links to more detailed guides for specific use cases.
/tokenX-PUB-KEY (required for admin token)expiresIn (optional for non-admin token)PERFORMANCE_SECRET_KEY environment variable is set on your server in the .env file..env environment variable EXPIRES_IN will be used.curl --location --request GET 'http://localhost:7000/token' \
--header 'X-PUB-KEY: your-public-key' \
curl --location --request GET 'http://localhost:7000/token' \
--data-urlencode 'expiresIn=2h'
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzIjoibHd1czh6NnAtZDYyNjBhN2RkYmIwODZlNCIsImQiOiIxIiwiYSI6dHJ1ZSwiaWF0IjoxNzE3MTY1OTE0LCJleHAiOjE3MTcxNjk1MTR9.eUTxAjLJ8NcP_I-mNgVAlUyQSJpSIuuQBNz6wDiYcXM"
}
The endpoint may return various HTTP status codes to indicate errors:
500 Internal Server Error: Secret key not configured or error generating the token.400 Bad Request: Invalid public key.{
"error": "Secret key not configured"
}
The /token endpoint performs the following tasks:
PERFORMANCE_SECRET_KEY environment variable is configured in your .env file.For more detailed information on generating specific types of tokens, refer to the following documents:
By following this guide, you should be able to successfully generate both admin and non-admin tokens using the /token endpoint.