Skip to content

Commit cafd471

Browse files
committed
Update tutorial to include cors-middleware
1 parent 24ee096 commit cafd471

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

docs/tutorial/tutorial_01.rst

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,23 @@ You want to make your own :term:`Authorization Server` to issue access tokens to
88
Start Your App
99
--------------
1010
During this tutorial you will make an XHR POST from a Heroku deployed app to your localhost instance.
11-
Since the domain that will originate the request (the app on Heroku) is different than the destination domain (your local instance),
12-
you will need to install the `django-cors-headers <https://github.com/ottoyiu/django-cors-headers>`_ app.
11+
Since the domain that will originate the request (the app on Heroku) is different than the destination domain (your local instance), you will need to use the cors-middleware that we're providing.
1312
These "cross-domain" requests are by default forbidden by web browsers unless you use `CORS <http://en.wikipedia.org/wiki/Cross-origin_resource_sharing>`_.
1413

15-
Create a virtualenv and install `django-oauth-toolkit` and `django-cors-headers`:
14+
Create a virtualenv and install `django-oauth-toolkit`:
1615

1716
::
1817

19-
pip install django-oauth-toolkit django-cors-headers
18+
pip install django-oauth-toolkit
2019

21-
Start a Django project, add `oauth2_provider` and `corsheaders` to the installed apps, and enable admin:
20+
Start a Django project, add `oauth2_provider` to the installed apps, and enable admin:
2221

2322
.. code-block:: python
2423
2524
INSTALLED_APPS = {
2625
'django.contrib.admin',
2726
# ...
2827
'oauth2_provider',
29-
'corsheaders',
3028
}
3129
3230
Include the Django OAuth Toolkit urls in your `urls.py`, choosing the urlspace you prefer. For example:
@@ -46,17 +44,11 @@ Include the CORS middleware in your `settings.py`:
4644
4745
MIDDLEWARE_CLASSES = (
4846
# ...
49-
'corsheaders.middleware.CorsMiddleware',
47+
'oauth2_provider.middleware.CorsMiddleware',
5048
# ...
5149
)
5250
53-
Allow CORS requests from all domains (just for the scope of this tutorial):
54-
55-
.. code-block:: python
56-
57-
CORS_ORIGIN_ALLOW_ALL = True
58-
59-
.. _loginTemplate:
51+
This will allow CORS requests from the redirect uris of your applications.
6052

6153
Include the required hidden input in your login template, `registration/login.html`.
6254
The ``{{ next }}`` template context variable will be populated with the correct

0 commit comments

Comments
 (0)