• Document Up to Date

Management Tokens

CrafterCMS uses authorization tokens for the Studio, Engine, Deployer, Search, Profile and Social modules. These tokens need to be passed as a parameter when using context (/api/1/site/context/*), cache (/api/1/site/cache/*) and monitoring (/api/1/monitoring/*, /studio/api/2/monitoring/*, /crafter-profile/api/1/monitoring/* and /crafter-social/api/3/monitoring/*) APIs, to allow access to the APIs.

CrafterCMS provides default values for the tokens. To change the default management authorization tokens, open bin/crafter-setenv.sh and change defaultManagementToken to desired token value:

bin/crafter-setenv.sh
# -------------------- Management tokens ----------------
export STUDIO_MANAGEMENT_TOKEN=${STUDIO_MANAGEMENT_TOKEN:="defaultManagementToken"}
export ENGINE_MANAGEMENT_TOKEN=${ENGINE_MANAGEMENT_TOKEN:="defaultManagementToken"}
export DEPLOYER_MANAGEMENT_TOKEN=${DEPLOYER_MANAGEMENT_TOKEN:="defaultManagementToken"}
export SEARCH_MANAGEMENT_TOKEN=${SEARCH_MANAGEMENT_TOKEN:="defaultManagementToken"}
export PROFILE_MANAGEMENT_TOKEN=${PROFILE_MANAGEMENT_TOKEN:="defaultManagementToken"}
export SOCIAL_MANAGEMENT_TOKEN=${SOCIAL_MANAGEMENT_TOKEN:="defaultManagementToken"}

Please update this per installation and provide this token to context, cache and monitoring APIs.

Here’s an example request to get the events recorded in the Crafter Engine log for a given site in a specific time period after changing the default ENGINE_MANAGEMENT_TOKEN token value to myCustomToken

bin/crafter-setenv.sh
export ENGINE_MANAGEMENT_TOKEN=${ENGINE_MANAGEMENT_TOKEN:="myCustomToken"}

Here’s the request sent with the new token value:

GET .../api/1/monitoring/log.json?site=editorial&since=1396772083660&token=myCustomToken