Skip to content

Commit

Permalink
OAuth setup moved to main readme
Browse files Browse the repository at this point in the history
  • Loading branch information
wooyek committed Jan 5, 2015
1 parent 72385c5 commit 2899c81
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 72 deletions.
73 changes: 59 additions & 14 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,27 @@ What’s missing?
This is just authentication blueprint there is no templates, models and
stuff that you would want to customize yourself.

What to do more?
----------------

1. More providers
2. Make Flask-Security dependency optional

Examples
--------

The core of this module has no GUI, but examples have a nice login
and profile page to show it it works. Checkout the `demo`_.

.. image:: https://github.com/wooyek/flask-social-blueprint/raw/master/docs/login-form.png
:alt: Flask social blueprint login form example
:align: center


.. image:: https://github.com/wooyek/flask-social-blueprint/raw/master/docs/user-profile.png
:alt: Flask social blueprint user profile example
:align: center

The example has a working model and templates, has a bunch of
dependencies like `Flask-SLQAlchemy`_, you can take it as a wire frame
modify and build your app with that.
Expand All @@ -97,26 +115,53 @@ requirements come from `Flask-security`_.
2. for `Google App Engine <example/gae/README.md>`_
3. for `MongoDB <example/mongodb/README.rst>`_

What to do more?
----------------
Setup OAuth with different providers
------------------------------------

1. More providers
2. Make Flask-Security dependency optional
This blueprint needs client id's and secrets provided by social services you
want to integrate with, here's where you setup them.

Demo screen shots
-----------------
In examples we use http://dev.example.com:5055 URL to overcome limitations
posed on localhost and 127.0.0.1 when setting up integrations.
The http:://example.com is guaranteed to be valid and may be used by
anyone in demos and documentation. Just map `dev.example.com` to 127.0.0.1
and you're good to go.

The core of this module has no GUI, but examples have a nice login
and profile page to show it it works. Checkout the `demo`_.
Callback URLs use the name of the provider at the end.
Obtain client ids and secrets from OAuth providers using
main URL http://dev.example.com:5055 and callbacks URLS like these:

.. image:: https://github.com/wooyek/flask-social-blueprint/raw/master/docs/login-form.png
:alt: Flask social blueprint login form example
:align: center
- http://dev.example.com:5055/_social/callback/Google
- http://dev.example.com:5055/_social/callback/Facebook
- http://dev.example.com:5055/_social/callback/Twitter
- http://dev.example.com:5055/_social/callback/Github

Twitter
^^^^^^^

Create new application here: https://apps.twitter.com/app/new

Google
^^^^^^

1. Create new project here: https://console.developers.google.com/project
2. In APIs & auth > Credentials create Client ID
3. Update consent screen details, at least product name, home page and email address
4. Enable Google+ API

GitHub
^^^^^^

Create new application here: https://github.com/settings/applications/new

Facebook
^^^^^^^^

Create new application here: https://developers.facebook.com/apps/

Setup `Valid OAuth redirect URIs` in Settings > Advanced > Security


.. image:: https://github.com/wooyek/flask-social-blueprint/raw/master/docs/user-profile.png
:alt: Flask social blueprint user profile example
:align: center

.. _Flask-Social: https://pythonhosted.org/Flask-Social/
.. _Flask-Security: https://pythonhosted.org/Flask-Security/
Expand Down
59 changes: 1 addition & 58 deletions example/gae/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,68 +3,11 @@
To run this example:

1. Map your loop back 127.0.0.1 ip address to dev.example.com
2. Obtain client ids and secrets from OAuth providers using URL:
http://dev.example.com:5055 and callbacks:
- http://dev.example.com:5055/_social/callback/Google
- http://dev.example.com:5055/_social/callback/Facebook
- http://dev.example.com:5055/_social/callback/Twitter
- http://dev.example.com:5055/_social/callback/Github
2. `Obtain client ids and secrets from OAuth providers <>` you want to integrate
3. Put them in the `website/settings.py` in the `SOCIAL_BLUEPRINT` settings
4. Install package dependencies
5. Run app engine development server
6. Open http://dev.example.com:5055 your browser

## Twitter

Create new application here: https://apps.twitter.com/app/new

## Google

1. Create new project here: https://console.developers.google.com/project
2. In APIs & auth > Credentials create Client ID
3. Update consent screen details, at least product name, home page and email address
4. Enable Google+ API

## Github

Create new application here: https://github.com/settings/applications/new

## Facebook

Create new application here: https://developers.facebook.com/apps/

Setup `Valid OAuth redirect URIs` in Settings > Advanced > Security

# Development environment setup for beginners

## Linux

```
sudo apt-get install python
sudo apt-get install python-dev
sudo apt-get install python-pip
sudo pip install virtualenv
```

## Windows

Install [python 2.7](https://www.python.org/download/releases/2.7/).
To quickly setup python start powershell and paste this script

(new-object System.Net.WebClient).DownloadFile("https://www.python.org/ftp/python/2.7.6/python-2.7.6.msi", "$pwd\python-2.7.6.msi"); msiexec /i python-2.7.6.msi TARGETDIR=C:\Python27
[Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27\;C:\Python27\Scripts\", "User")

Install [Pip](http://pip.readthedocs.org/en/latest/installing.html) using powershell

(new-object System.Net.WebClient).DownloadFile("https://raw.github.com/pypa/pip/master/contrib/get-pip.py", "$pwd\get-pip.py"); C:\Python27\python.exe get-pip.py virtualenv

or using python itself

python -c "exec('try: from urllib2 import urlopen \nexcept: from urllib.request import urlopen');f=urlopen('https://raw.github.com/pypa/pip/master/contrib/get-pip.py').read();exec(f)"

## Virtualenv

Create and [activate virtual environment](http://virtualenv.readthedocs.org/en/latest/virtualenv.html#activate-script)

pip install -r requirements

0 comments on commit 2899c81

Please sign in to comment.