Created
May 9, 2017 21:04
-
-
Save joshbetz/26903ccca8faa73abd0fb264845e0f49 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/bash | |
client_id=$1 | |
client_secret=$2 | |
redirect_uri=$3 | |
if [[ -z $client_id || -z $client_secret || -z $redirect_uri ]]; then | |
echo "Usage: $0 <client_id> <client_secret> <redirect_uri>" | |
exit 1 | |
fi | |
open "https://public-api.wordpress.com/oauth2/authorize?client_id=$client_id&redirect_uri=$redirect_uri&response_type=code" | |
read -p "Enter the code: " code | |
echo | |
curl https://public-api.wordpress.com/oauth2/token -d "client_id=$client_id&client_secret=$client_secret&code=$code&redirect_uri=$redirect_uri&grant_type=authorization_code" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment