Skip to content

Instantly share code, notes, and snippets.

@adam8810
Created April 19, 2018 15:26
Show Gist options
  • Save adam8810/82e98d34537816f93ce96d11f300b893 to your computer and use it in GitHub Desktop.
Save adam8810/82e98d34537816f93ce96d11f300b893 to your computer and use it in GitHub Desktop.
Copies a new JWT token to your clipboard
#!/bin/bash
CLIENT_ID= # Add client id
CLIENT_SECRET= # Add client secret
AUTH_TOKEN_URL= # Add token url
AUDIENCE= # Add audience
curl --silent --request POST \
--url $AUTH_TOKEN_URL \
--header 'content-type: application/json' \
--data "{\"client_id\":\"$CLIENT_ID\",\"client_secret\":\"$CLIENT_SECRET\",\"audience\":\"$AUDIENCE\",\"grant_type\":\"client_credentials\"}" 2>&1 | \
grep -Eoi 'ey([^"]+)' | \
pbcopy; \
echo "Copied to clipboard"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment