Sign inSign up

moertel/facebook-token-generator

By moertel

•Updated over 9 years ago

Generates long-lived access tokens for any given Facebook app and user credentials

Image
0

1.3K

moertel/facebook-token-generator repository overview

⁠Facebook Token Generator

Docker Automated build    

For server apps which should run in the background without any user interaction, Facebook's policy of expiring access tokens after 60 days is rather inconvenient. This app will generate long-lived tokens by mimicking user interactions in the browser (via PhantomJS) and save the tokens to your local file system.

⁠Run

If you mount your local volume /path/to/dir into the container, the tokens will be stored at:

  • /path/to/dir/shortLivedAuthToken.txt
  • /path/to/dir/longLivedAuthToken.txt
$ docker run -e FB_CLIENT_ID=123 -e FB_CLIENT_SECRET=xzy \
    -e [email protected] -e FB_USER_PASSWORD=secret \
    -e FB_SCOPES=email,user_friends \
    -v /path/to/dir:/token \
    -it moertel/facebook-token-generator
⁠Environment Variables
  • FB_CLIENT_ID: The client ID of your Facebook application
  • FB_CLIENT_SECRET: The client secret of your Facebook application
  • FB_SCOPES (optional): Comma-separated list of scopes to request
  • FB_USER_EMAIL: Email address of Facebook user account for which to obtain an access token
  • FB_USER_PASSWORD: Password of Facebook user account
⁠Languages other than English

This script assumes that your Facebook language is English. If you use Facebook in another language, you may want to override the button texts:

  • FB_BUTTON_TEXT_GETTOKEN (optional): Default is "Get Token"
  • FB_BUTTON_TEXT_GETUSERACCESSTOKEN (optional): Default is "Get User Access Token"
  • FB_BUTTON_TEXT_GETACCESSTOKEN (optional): Default is "Get Access Token"

Tag summary

Content type

Image

Digest

Size

122.6 MB

Last updated

over 9 years ago

docker pull moertel/facebook-token-generator