Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 34 lines (25 sloc) 1.11 kB
#!/bin/sh
umask 077
if [ $# = 4 ]; then
request_token_url="$1"
authorize_url="$2"
access_token_url="$3"
output_creds="$4"
else
echo "usage: $0 REQ_TOKEN_URL AUTHORIZE_URL ACCESS_TOKEN_URL OUTPUT_CREDS"
exit 2
fi
consumer_tmp=$(mktemp -t curlicue_consumer.XXXXXX)
request_token_tmp=$(mktemp -t curlicue_request_token.XXXXXX)
access_token_tmp=$(mktemp -t curlicue_access_token.XXXXXX)
read -p 'Consumer key: ' key
read -p 'Consumer secret: ' secret
curl-encode "oauth_consumer_key=$key" "oauth_consumer_secret=$secret" > "$consumer_tmp"
curlicue -f "$consumer_tmp" -p 'oauth_callback=oob' -- \
-s -X POST "$request_token_url" > "$request_token_tmp"
echo "Load this URL: $(curlicue -f "$consumer_tmp" -f "$request_token_tmp" -e "$authorize_url")"
read -p 'Paste the PIN you got here: ' pin
curlicue -f "$consumer_tmp" -f "$request_token_tmp" ${pin:+-p "oauth_verifier=$pin"} -- \
-s -X POST "$access_token_url" > "$access_token_tmp"
paste -d '&' "$consumer_tmp" "$access_token_tmp" > "$output_creds"
echo "OK! Now you can run: curlicue -f $output_creds [-- CURL_OPTS] URL"
Jump to Line
Something went wrong with that request. Please try again.