Author: Lisa
Sausage, broccoli, cheddar stufflers
Growing Space
Apples progressing
Philly Cheesesteak Pizza
Apple Progress
Getting an OAUTH Token for Bearer Auth
Quick script to mint and decode an OAUTH bearer token … requires CLIENT_ID and CLIENT_SECRET variables with data.
TOKEN_URL='https://oauth.example.com/as/token.oauth2'
INTROSPECT_URL='https://oauth.example.com/as/introspect.oauth2'
TOKEN=$(curl -s -k -X POST "$TOKEN_URL" \
-H 'Content-Type: application/x-www-form-urlencoded' \
-u "${CLIENT_ID}:${CLIENT_SECRET}" \
-d 'grant_type=client_credentials&scope=openid profile email' | jq -r '.access_token')
if [ -z "$TOKEN" ] || [ "$TOKEN" = "null" ]; then
echo "Failed to obtain access token"
exit 1
fi
echo "=== JWT HEADER ==="
HEADER=$(echo "$TOKEN" | cut -d '.' -f1)
LEN=$(( ${#HEADER} % 4 ))
if [ $LEN -eq 2 ]; then HEADER="${HEADER}=="; fi
if [ $LEN -eq 3 ]; then HEADER="${HEADER}="; fi
echo "$HEADER" | tr '_-' '/+' | base64 -d 2>/dev/null | jq
echo
echo "=== JWT PAYLOAD ==="
PAYLOAD=$(echo "$TOKEN" | cut -d '.' -f2)
LEN=$(( ${#PAYLOAD} % 4 ))
if [ $LEN -eq 2 ]; then PAYLOAD="${PAYLOAD}=="; fi
if [ $LEN -eq 3 ]; then PAYLOAD="${PAYLOAD}="; fi
echo "$PAYLOAD" | tr '_-' '/+' | base64 -d 2>/dev/null | jq
echo
echo "=== INTROSPECTION ==="
curl -s -k \
-u "${CLIENT_ID}:${CLIENT_SECRET}" \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d "token=$TOKEN" \
"$INTROSPECT_URL" | jq
The Void
We’ve been cleaning up the farm … but I don’t have any pictures for about a week.
Read Everything
We bought a fabric thing that is 1’x4′ — which seems like it would be the size of the item. It did not fit our one foot by four foot thing … so I measured it and was disappointed to discover it was not quite 4 foot long (it’s about 1/8″ short of one foot as well!). Read through the entire product listing to discover a “dimensions” about eight bullet points down. And it claims it will be 47 3/8″ … pretty much exactly the length I am measuring. So, yeah, read the ten paragraphs of description because sometimes they hide important details in there!







