Last active
April 19, 2016 20:00
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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