Skip to content

Instantly share code, notes, and snippets.

View timhodson's full-sized avatar

Tim Hodson timhodson

View GitHub Profile
@timhodson
timhodson / persona-token
Last active April 19, 2016 20:00
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