Skip to content

Instantly share code, notes, and snippets.

@rssnyder
Created June 13, 2024 13:22
Show Gist options
  • Save rssnyder/15abe71d7f451f66a33bc0a0a02d13b8 to your computer and use it in GitHub Desktop.
Save rssnyder/15abe71d7f451f66a33bc0a0a02d13b8 to your computer and use it in GitHub Desktop.
# fill in these values
API_KEY=
FLAG=
HOST=config.ff.harness.io
TARGET=foo
# Authenticate as a client SDK with target
AUTH_TOKEN=$(curl -X POST "https://$HOST/api/1.0/client/auth" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"apiKey\":\"$API_KEY\",\"target\":{\"identifier\":\"$TARGET\"}}" | jq -r '.authToken')
# Get Cluster ID and Env ID from request
CLUSTER_ID=$(echo $AUTH_TOKEN | jq -R 'split(".") | .[1] | @base64d | fromjson' | jq -r '.clusterIdentifier')
ENV_ID=$(echo $AUTH_TOKEN | jq -R 'split(".") | .[1] | @base64d | fromjson' | jq -r '.environment')
# Start stream
curl --trace-ascii - -N \
-H "authorization: Bearer ${AUTH_TOKEN}" \
-H "api-key: ${API_KEY}" \
"https://$HOST/api/1.0/stream?cluster=$CLUSTER_ID"
# once stream is open, you can toggle a flag in the UI and you should see the payload printed in your terminal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment