Getting an authentication token with curl

Send a request to the Identity Provider service to get an Authentication token.

$ JWT="$(curl -s -X POST -u "$SUBJECT_ID:$PASSWORD" "$IDP_URL/idp/v1/tokens" | jq -r .)" && export JWT

Authentication tokens have a two-minute validity, so you must periodically rerun this command.

Check the token contents – for example:

$ echo $JWT
eyJhbGciOiJSUzI1NiIsImtpZCI6InBraWh1YmlkcDE1NTg5NDA3NjkiLCJ0eXAiOiJKV1QifQ...

When the token generation fails, you get an error like the following.

{ "code": 401, "message": "Unauthorized" }