Skip to content

Instantly share code, notes, and snippets.

@thefinn93
Created March 5, 2014 03:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thefinn93/9360835 to your computer and use it in GitHub Desktop.
Save thefinn93/9360835 to your computer and use it in GitHub Desktop.
Bash script to get Facespace login token
#!/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