Skip to content

Instantly share code, notes, and snippets.

@timhodson
Last active April 19, 2016 20:00
Show Gist options
  • Save timhodson/c7032d7eefdff8eba90dd32f1e1eb019 to your computer and use it in GitHub Desktop.
Save timhodson/c7032d7eefdff8eba90dd32f1e1eb019 to your computer and use it in GitHub Desktop.
Shell script to get a Talis Persona Token to authenticate calls to the Talis OAuth APIs
#!/bin/bash
# Usage: persona-token <client_id> <client_secret>
# you are advised to add your client secret to an environment variable so that you are not leaving secrets in your command history.
PERSONA_HOST='users.talis.com'
CLIENT=$1
SECRET=$2
TOKEN=$(curl -sS -u $CLIENT:$SECRET http://${PERSONA_HOST}/oauth/tokens -d 'grant_type=client_credentials'|sed -e 's/{"access_token":"\(.*\)","expires_in":\(.*\),"token_type":"\(.*\)","scope":"\(.*\)"}/\1/g')
echo $TOKEN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment