Skip to content

Commit

Permalink
Added a note to about using flask.session. Fixes authomatic#74.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhudec committed Dec 17, 2014
1 parent 5beb946 commit 075a79b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@
}

intersphinx_mapping = {
'flask': ('http://flask.pocoo.org/docs/', None),
'python': ('http://docs.python.org/2.7', None),
'django': ('http://docs.djangoproject.com/en/dev/',
'http://docs.djangoproject.com/en/dev/_objects/'),
Expand Down
17 changes: 17 additions & 0 deletions doc/source/examples/flask-simple.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,23 @@ The handler must return the ``response`` so we assign it to a variable.
:language: python
:lines: 34, 37

.. note::

If you want to use the :class:`flask.session`, you can do it like this:

.. code-block:: python
:emphasize-lines: 7-8
# You need to set a secret string otherwise the session will not work.
app.secret_key = 'random secret string'
result = authomatic.login(
WerkzeugAdapter(request, response),
provider_name,
session=session,
session_saver=lambda: app.save_session(session, response)
)
Now check whether there is a :class:`.LoginResult`.
If so, we need to update the :class:`.User` to get **his/her** info.
Then just pass the whole :class:`.LoginResult` to the template.
Expand Down

0 comments on commit 075a79b

Please sign in to comment.