Skip to content

Tri125/facebookLogin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

facebookLogin

The simple server-side facebook login flow.

How to install

Grab the latest version:

go get -u github.com/Tri125/facebookLogin

facebookLogin uses dep to manage its dependencies.

Install dep:

go get -u github.com/golang/dep/cmd/dep

Install the dependencies:

dep ensure

Install facebookLogin:

go build

Run the proxy

Preparation

Follow the instruction from facebook to create your facebook application.

You will want to Require App Secret and create a Facebook Login product.

Under the Settings > Basic tab at the top left, take note of your appID and appSecret.

Your appID can be public but you have to secure the appSecret at all cost.

Under the settings tab of the Facebook Login product, write all of your Valid OAuth redirect URI.

This is the URI(s) where your login button is present.

You can write http://localhost:8080 if you are going to run locally on the default port.

Usage

Just execute the program while supplying the appID and appSecret flags, you can also set them through environment variables:

./facebookLogin --appID <appID> --appSecret <secret>

You can now make call to the proxy in the following format:

curl -X POST -d '{"token": "<fbToken>"}' localhost:8080?field="first_name,last_name,email,locale"

If you would like a full demo environment, run the local command:

./facebookLogin local --appID <appID> --appSecret <secret>

This will generate a website where you will be able to test how everything works.

Just open a website at http://localhost:8080/dev and look at the javascript console.

For more information on the available commands:

./facebookLogin --help

How to modify the template

Modify templates/index.html

Install go-bindata:

go get -u github.com/jteeuwen/go-bindata/...

Convert the file into Go source file and overwrite bindata.go:

go-bindata -o data/bindata.go templates/