Configuring Facebook OAuth

Introduction

This article describes how to configure Geo2Tag for using Facebook OAuth. The configuring takes place in two stages. First you need to create a new application in the interface of Developers.Facebook, then to set parameters for authorization in configuration file of Geo2Tag: config.ini.

Creation and setting app in Developers.Facebook

  1. Create a new app in portal https://developers.facebook.com
  2. Skip the help window Quick Start using the button “Skip Quick Start” in order to proceed to information about the application.
  3. Go to the tab Settings, here there are necessary data for authorization: App ID; AppSecret;
  4. Also you have to specify Site URL and App Domains as stated above (for local testing authorization)
  5. Then go to the tab Advanced. Permission to connect via OAuth is enabled by default so everything you need is to specify link  https://<domain name of the host>/<prefix (by default instance)>/login/facebook/authorized in the fieldValid OAuth Redirect URL’s“.  If you don’t know your prefix you can find its value in the file /var/www/geomongo/config.ini, parameter instance_prefix.
  6. Further go to the tab Status & Review and set switch to position YES in front of the text: Do you want to make this app and all its live features available to the general public?

Setting config.ini

For further setting  you should to open the file /var/www/geomongo/config.ini  in any text editor and change the section (add if this section didn’t exist previously) “Facebook_OAuth” as follows: 

[Facebook_OAuth]

FACEBOOK_CLIENT_ID=<Data from the field "App ID">
FACEBOOK_CLIENT_SECRET=<Data from the field "App Secret">
FACEBOOK_REDIRECT_URL=<Links from "Valid OAuth Redirect URL's">

Testing

For testing you need to:

  1. follow the link /<Prefix>/login,
  2. press the button “Sign in with Facebook”,
  3. enter login and password,
  4. allow the using API,
  5. after that you will be redirected to the page “/instance/login/facebook/authorized?”where the text “Success” will be showed.
ShareShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on VKEmail this to someone