Last active
August 1, 2018 21:22
-
-
Save fourdollars/6027400 to your computer and use it in GitHub Desktop.
A simple shell script to get OAuth tokens from https://launchpad.net/ .
This file contains 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/sh | |
oauth_consumer_key='just+testing' | |
for x in $(wget -q --post-data "oauth_consumer_key=$oauth_consumer_key&oauth_signature_method=PLAINTEXT&oauth_signature=%26" https://launchpad.net/+request-token -O - | sed 's/&/ /g'); do | |
case "$x" in | |
(oauth_token=*) | |
oauth_token="${x#*=}" | |
;; | |
(oauth_token_secret=*) | |
oauth_token_secret="${x#*=}" | |
;; | |
esac | |
done | |
xdg-open "https://launchpad.net/+authorize-token?oauth_token=$oauth_token" | |
read -p 'Press Enter after authorized... ' blah | |
for x in $(wget -q --post-data "oauth_consumer_key=$oauth_consumer_key&oauth_token=$oauth_token&oauth_signature_method=PLAINTEXT&oauth_signature=%26$oauth_token_secret" https://launchpad.net/+access-token -O - | sed 's/&/ /g'); do | |
case "$x" in | |
(oauth_token=*) | |
oauth_token="${x#*=}" | |
;; | |
(oauth_token_secret=*) | |
oauth_token_secret="${x#*=}" | |
;; | |
(lp.context=*) | |
if [ "${x#*=}" = 'None' ]; then | |
echo "oauth_token $oauth_token" | |
echo "oauth_token_secret $oauth_token_secret" | |
fi | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment