Skip to content

Instantly share code, notes, and snippets.

@nejckorasa
Created July 31, 2018 13:52
Show Gist options
  • Select an option

  • Save nejckorasa/c10c06860830bc2d1f591e1c05aa969f to your computer and use it in GitHub Desktop.

Select an option

Save nejckorasa/c10c06860830bc2d1f591e1c05aa969f to your computer and use it in GitHub Desktop.
Script to retrieve and print OAuth token from Auth provider
#!/bin/bash
TOKEN_URI='http://bla.si:8180/auth/realms/ble/protocol/openid-connect/token'
CLIENT_ID='js-client'
USERNAME='taavci'
PASSWORD='test'
RESULT=`curl --data "grant_type=password&client_id=$CLIENT_ID&username=$USERNAME&password=$PASSWORD" $TOKEN_URI`
TOKEN=`echo $RESULT | sed 's/.*access_token":"//g' | sed 's/".*//g'`
echo -e '\nTOKEN:\n'
echo $TOKEN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment