Debian Codegraph @

docs/socialaccount/providers/mailchimp.rst

raw
1 MailChimp (OAuth 2)
2 -------------------
3
4 MailChimp has a simple API for working with your own data and a `good library`_
5 already exists for this use. However, to allow other MailChimp users to use an
6 app you develop, the OAuth2 API allows those users to give or revoke access
7 without creating a key themselves.
8
9 .. _good library: https://pypi.python.org/pypi/mailchimp3
10
11 Registering a new app
12 *********************
13
14 Instructions for generating your own OAuth2 app can be found at
15 https://developer.mailchimp.com/documentation/mailchimp/guides/how-to-use-oauth2/.
16 It is worth reading that carefully before following the instructions below.
17
18 Login via https://login.mailchimp.com/, which will redirect you to
19 ``https://usX.admin.mailchimp.com/`` where the prefix ``usX`` (``X`` is an
20 integer) is the subdomain you need to connect to. Click on your username in the
21 top right corner and select *Profile*. On the next page select *Extras* then
22 click API keys, which should lead you to:
23
24 App registration (where ``X`` is dependent on your account)
25 https://usX.admin.mailchimp.com/account/oauth2/
26
27 Fill in the form with the following URL for local development:
28
29 Development callback URL
30 https://127.0.0.1:8000/accounts/mailchimp/login/callback/
31
32 Testing Locally
33 ***************
34
35 Note the requirement of **https**. If you would like to test OAuth2
36 authentication locally before deploying a default django project will raise
37 errors because development mode does not support ``https``. One means of
38 circumventing this is to install ``django-extensions``::
39
40 pip install django-extensions
41
42 add it to your ``INSTALLED_APPS``
43
44 .. code-block:: python
45
46 INSTALLED_APPS = (
47 ...
48 'django_extensions',
49 ...
50 )
51
52 and then run::
53
54 ./manage.py runserver_plus --cert cert
55
56 which should allow you to test locally via https://127.0.0.1:8000. Some
57 browsers may require enabling this on localhost and not support by default and
58 ask for permission.