#!/usr/bin/sh curl -v http://localhost:8085/authorize \ -G \ -D "tmp/headers.txt" \ --cookie "tmp/.curl-cookies" \ -d client_id="a1785786-8be1-443c-9a6f-35feed703609" \ -d response_type="code" \ -d redirect_uri="http://localhost:9090/callback" \ -d scope="user_read_basic" \ -d state="qxYAfk4kf6pbZkms78jM" code="$(cat tmp/headers.txt | grep -i "location" | awk -F ": " '{print $2}' | trurl -f - -g "{query:code}")" echo "$code" > tmp/authorize_code.txt