MarketGardenLog is a Python web application developed with Flask, to keep a registry of a garden, allowing to create different types of plants and gardens, and filter the gardens and plants by its type.
The application implements a third-party authentication & authorization service, in this case G+ and Facebook OAuth services.
The repository contains the virtual machine configuration to use with Vagrant in the /vagrant
directory.
Once started and logged in the vagrant machine, go to /vagrant/marketgardenlog/
directory.
To create de DB schema you need to execute $ python database_setup.py
For the authentication system to work you need to create a Client ID and Secret and save it in a json file.
To obtain the Client ID and Secret you have to:
- Go to https://console.developers.google.com/apis.
- In the section Credentials you need to create an OAuth Client ID.
- When you're presented with a list of application types, choose Web application.
- In the configuration page add http://localhost:5000 in the "Authorised JavaScript origins" section and http://localhost:5000/login and http://localhost:5000/gconnect in the "Authorised redirect URIs" section.
- Download the json file with the configuration clicking in the "Download JSON button" and save it as
client_secrets.json
in themarketgardenlog/
directory. - In the
login.html
file , in the signin button replace the GOOGLE_CLIENT_ID_HERE with your client id.
- Register a new application in the Facebook Developers Page.
- In the app page click in "+ Add Product", and add Facebook Login.
- In the configuration of the product, in "Valid OAuth redirect URIs" add http://localhost:5000.
- From the dashboard of the app copy the Client ID and the Secret in a new json file called
fb_client_secrets.json
using the following format: { "web": { "app_id": "PASTE_YOUR_APP_ID_HERE", "app_secret": "PASTE_YOUR_CLIENT_SECRET_HERE" } } - In the
login.html
file , in the Facebook login section replace the FACEBOOK_APP_ID_HERE with your app id.
To run the application type $ python marketgardenlog.py
. Now the server is running and listening in port 5000.
You can view the web page in your browser going to http://localhost:5000