Dev guideRecipesAPI ReferenceChangelog
Dev guideRecipesUser GuidesNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev guide

Basic

The easiest administrative access

Basic authentication sends user credentials with each HTTP request as a Base64-encoded value. Because Base64 provides encoding rather than encryption, this method offers limited security and is best suited for trusted environments where the request travels over HTTPS.

Include the encoded credentials in the Authorization header using the following format:

Authorization: Basic base64(APP_KEY:SECRET)

Supply your Hash-based Message Authentication Code (HMAC) APP_KEY as the username and SECRET as the password. HTTP clients such as Postman generate the required authorization header automatically. When your client does not support Basic authentication, encode the APP_KEY:SECRET value using Base64 and include it in the request.

cURL example

Use this curl command to send a GraphQL query authenticated with Basic credentials.

curl -X POST "https://cg.optimizely.com/content/v2" \
-H "Authorization: Basic BASE64_ENCODED_CREDENTIALS" \
-H "Content-Type: application/json" \
-d '{"query": "{ BlogPost { total } }"}'
📘

Note

Use echo -n "username:password" | base64 to encode your credentials.