Created
March 5, 2014 03:50
-
-
Save thefinn93/9360835 to your computer and use it in GitHub Desktop.
Bash script to get Facespace login token
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/bash | |
# FILL THIS IN! Find or create your app at https://developers.facebook.com/apps | |
APP_ID= | |
# We output status to stderr so that the token can be piped in | |
output() { echo -e "$@" 1>&2; } | |
URL="https://www.facebook.com/dialog/oauth?client_id=$APP_ID" | |
URL="$URL&redirect_uri=https://www.facebook.com/connect/login_success.html" | |
URL="$URL&response_type=token&scope=publish_stream,manage_pages" | |
xdg-open $URL > /dev/null || output "Please open $URL to login." | |
ACCESS_TOKEN="" | |
output "Waiting for Facebook login token\c" | |
while [ "$ACCESS_TOKEN" == "" ]; do | |
output ".\c" | |
ACCESS_TOKEN=$(xwininfo -root -tree | grep "access_token=" | cut -d "=" -f2 | cut -d "&" -f1) | |
sleep 1 | |
done | |
output "Success" | |
echo $ACCESS_TOKEN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment