Created
July 31, 2018 13:52
-
-
Save nejckorasa/c10c06860830bc2d1f591e1c05aa969f to your computer and use it in GitHub Desktop.
Script to retrieve and print OAuth token from Auth provider
This file contains hidden or 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 | |
| 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