<commit_before>Providers
=========

Most providers require you to sign up for a so called API client or app,
containing a client ID and API secret. You must add a ``SocialApp``
record per provider via the Django admin containing these app
credentials.

When creating the OAuth app on the side of the provider pay special
attention to the callback URL (sometimes also referred to as redirect
URL). If you do not configure this correctly, you will receive login
failures when attempting to log in, such as::

    An error occurred while attempting to login via your social network account.

Use a callback URL of the form::

    http://example.com/accounts/twitter/login/callback/
    http://example.com/accounts/soundcloud/login/callback/
    ...

For local development, use the following::

    http://127.0.0.1:8000/accounts/twitter/login/callback/


23andMe
-------

App registration (get your key and secret here)
    https://api.23andme.com/dev/

Development callback URL
    http://localhost:8000/accounts/23andme/login/callback/


500px
-----

App registration (get your key and secret here)
    https://500px.com/settings/applications

Development callback URL
    http://localhost:8000/accounts/500px/login/callback/


Amazon
------

Amazon requires secure OAuth callback URLs (``redirect_uri``), please
see the section on HTTPS about how this is handled.

App registration (get your key and secret here)
    http://login.amazon.com/manageApps

Development callback URL
    https://example.com/accounts/amazon/login/callback/


AngelList
---------

App registration (get your key and secret here)
    https://angel.co/api/oauth/clients

Development callback URL
    http://localhost:8000/accounts/angellist/login/callback/


Auth0
-----

App registration (get your key and secret here)
    https://manage.auth0.com/#/clients

Development callback URL
    http://localhost:8000/accounts/auth0/login/callback/


You'll need to specify the base URL for your Auth0 domain:

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'auth0': {
            'AUTH0_URL': 'https://your.auth0domain.auth0.com',
        }
    }


Authentiq
---------

Browse to https://www.authentiq.com/developers to get started.

App registration
    https://dashboard.authentiq.com/

Sign in or register with your Authentiq ID (select ``Download the app`` while signing in if you don't have Authentiq ID yet).

Development redirect URL
    http://localhost:8000/accounts/authentiq/login/callback/

While testing you can leave the ``Redirect URIs`` field empty in the dashboard. You can specify what identity details to request via the ``SCOPE`` parameter.

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'authentiq': {
          'SCOPE': ['email', 'aq:name']
        }
    }

Valid scopes include: ``email``, ``phone``, ``address``, ``aq:name``, ``aq:location``. The default is to request a user's name, and email address if ``SOCIALACCOUNT_QUERY_EMAIL=True``. You can request and require a verified email address by setting ``SOCIALACCOUNT_EMAIL_VERIFICATION=True`` and ``SOCIALACCOUNT_EMAIL_REQUIRED=True``.

Baidu
-----

The Baidu OAuth2 authentication documentation:
    http://developer.baidu.com/wiki/index.php?title=docs/oauth/refresh
    http://developer.baidu.com/wiki/index.php?title=docs/oauth/rest/file_data_apis_lista


Basecamp
--------

App registration (get your key and secret here)
    https://integrate.37signals.com/

The Basecamp OAuth2 authentication documentation
    https://github.com/basecamp/api/blob/master/sections/authentication.md#oauth-2

Development callback URL
    https://localhost:8000/accounts/basecamp/login/callback/


Battle.net
----------

The Battle.net OAuth2 authentication documentation
    https://dev.battle.net/docs/read/oauth

Register your app here (Mashery account required)
    https://dev.battle.net/apps/register

Development callback URL
    https://localhost:8000/accounts/battlenet/login/callback/

Note that in order to use battletags as usernames, you are expected to override
either the ``username`` field on your User model, or to pass a custom validator
which will accept the ``#`` character using the ``ACCOUNT_USERNAME_VALIDATORS``
setting. Such a validator is available in
``socialaccount.providers.battlenet.validators.BattletagUsernameValidator``.


Bitbucket
---------

App registration (get your key and secret here)
    https://bitbucket.org/account/user/{{yourusername}}/oauth-consumers/new

Make sure you select the Account:Read permission.

Development callback URL
    http://127.0.0.1:8000/accounts/bitbucket_oauth2/login/callback/

Note that Bitbucket calls the ``client_id`` *Key* in their user interface.
Don't get confused by that; use the *Key* value for your ``client_id`` field.


Box
---

App registration (get your key and secret here)
    https://app.box.com/developers/services/edit/

Development callback URL
    http://localhost:8000/accounts/box/login/callback/


Dataporten
----------

App registration (get your key and secret here)
    https://docs.dataporten.no/docs/gettingstarted/

Development callback URL
    http://localhost:8000/accounts/dataporten/login/callback


daum
----

App registration (get your key and secret here)
    https://developers.daum.net/console

Development callback URL
    http://127.0.0.1:8000/accounts/daum/login/callback/


DigitalOcean
------------

App registration (get your key and secret here)
    https://cloud.digitalocean.com/settings/applications

Development callback URL
    http://127.0.0.1:8000/accounts/digitalocean/login/callback/

With the acquired access token you will have read permissions on the API by
default.  If you also need write access specify the scope as follows.  See
https://developers.digitalocean.com/documentation/oauth/#scopes for details.

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'digitalocean': {
            'SCOPE': [
                'read write',
            ],
        }
    }


Discord
-------

App registration and management (get your key and secret here)
    https://discordapp.com/developers/applications/me

Make sure to Add Redirect URI to your application.

Development callback (redirect) URL
    http://127.0.0.1:8000/accounts/discord/login/callback/


Doximity
--------

Doximity Oauth2 implementation documentation
    https://www.doximity.com/developers/documentation#oauth

Request API keys here
    https://www.doximity.com/developers/api_signup

Development callback URL
    http://localhost:8000/accounts/doximity/login/callback/


Draugiem
--------

App registration (get your key and secret here)
    https://www.draugiem.lv/applications/dev/create/?type=4

Authentication documentation
    https://www.draugiem.lv/applications/dev/docs/passport/

Development callback URL
    http://localhost:8000/accounts/draugiem/login/callback/


Dropbox
-------

App registration (get your key and secret here)
    https://www.dropbox.com/developers/apps/

Development callback URL
    http://localhost:8000/accounts/dropbox/login/callback/

Note that Dropbox has deprecated version 1 of their API as of 28 June 2016. The original OAuth1 `dropbox` provider has been updated to OAuth2 and the newer URL endpoints for OAuth2 authentication and authorization.

The `dropbox_oauth2` provider is deprecated and will be removed after September 28, 2017.

Dwolla
------------

App registration (get your key and secret here)
    https://dashboard-uat.dwolla.com/applications

Development callback URL
    http://127.0.0.1:8000/accounts/dwolla/login/callback/


.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'dwolla': {
            'SCOPE': [
                'Send',
                'Transactions',
                'Funding',
                'AccountInfoFull',
            ],
            'ENVIROMENT':'sandbox',
        }
    }


Edmodo
------

Edmodo OAuth2 documentation
    https://developers.edmodo.com/edmodo-connect/edmodo-connect-overview-getting-started/

You can optionally specify additional permissions to use. If no ``SCOPE``
value is set, the Edmodo provider will use ``basic`` by default:

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'edmodo': {
            'SCOPE': [
                'basic',
                'read_groups',
                'read_connections',
                'read_user_email',
                'create_messages',
                'write_library_items',
            ]
        }
    }


Eve Online
----------

Register your application at ``https://developers.eveonline.com/applications/create``.
Note that if you have ``STORE_TOKENS`` enabled (the default), you will need to
set up your application to be able to request an OAuth scope. This means you
will need to set it as having "CREST Access". The least obtrusive scope is
"publicData".


Eventbrite
------------------

Log in and click your profile name in the top right navigation, then select
``Account Settings``. Choose ``App Management`` near the bottom of the left
navigation column. You can then click ``Create A New App`` on the upper left
corner.

App registration
    https://www.eventbrite.com/myaccount/apps/

Fill in the form with the following link

Development callback URL
    http://127.0.0.1:8000/accounts/eventbrite/login/callback/

for both the ``Application URL`` and ``OAuth Redirect URI``.


Evernote
--------

Register your OAuth2 application at ``https://dev.evernote.com/doc/articles/authentication.php``:

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'evernote': {
            'EVERNOTE_HOSTNAME': 'evernote.com'  # defaults to sandbox.evernote.com
        }
    }


Facebook
--------

For Facebook both OAuth2 and the Facebook Connect Javascript SDK are
supported. You can even mix the two.

An advantage of the Javascript SDK may be a more streamlined user
experience as you do not leave your site. Furthermore, you do not need
to worry about tailoring the login dialog depending on whether or not
you are using a mobile device. Yet, relying on Javascript may not be
everybody's cup of tea.

To initiate a login use:

.. code-block:: python

    {% load socialaccount %}
    {% providers_media_js %}
    <a href="{% provider_login_url "facebook" method="js_sdk" %}">Facebook Connect</a>

or:

.. code-block:: python

    {% load socialaccount %}
    <a href="{% provider_login_url "facebook" method="oauth2" %}">Facebook OAuth2</a>

The following Facebook settings are available:

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'facebook': {
            'METHOD': 'oauth2',
            'SCOPE': ['email', 'public_profile', 'user_friends'],
            'AUTH_PARAMS': {'auth_type': 'reauthenticate'},
            'INIT_PARAMS': {'cookie': True},
            'FIELDS': [
                'id',
                'email',
                'name',
                'first_name',
                'last_name',
                'verified',
                'locale',
                'timezone',
                'link',
                'gender',
                'updated_time',
            ],
            'EXCHANGE_TOKEN': True,
            'LOCALE_FUNC': 'path.to.callable',
            'VERIFIED_EMAIL': False,
            'VERSION': 'v2.4',
        }
    }

METHOD:
    Either ``js_sdk`` or ``oauth2``. The default is ``oauth2``.

SCOPE:
    By default, the ``email`` scope is required depending on whether or not
    ``SOCIALACCOUNT_QUERY_EMAIL`` is enabled.
    Apps using permissions beyond ``email``, ``public_profile`` and ``user_friends``
    require review by Facebook.
    See `Permissions with Facebook Login <https://developers.facebook.com/docs/facebook-login/permissions>`_
    for more information.

AUTH_PARAMS:
    Use ``AUTH_PARAMS`` to pass along other parameters to the ``FB.login``
    JS SDK call.

FIELDS:
    The fields to fetch from the Graph API ``/me/?fields=`` endpoint.
    For example, you could add the ``'friends'`` field in order to
    capture the user's friends that have also logged into your app using
    Facebook (requires ``'user_friends'`` scope).

EXCHANGE_TOKEN:
    The JS SDK returns a short-lived token suitable for client-side use. Set
    ``EXCHANGE_TOKEN = True`` to make a server-side request to upgrade to a
    long-lived token before storing in the ``SocialToken`` record. See
    `Expiration and Extending Tokens <https://developers.facebook.com/docs/facebook-login/access-tokens#extending>`_.

LOCALE_FUNC:
    The locale for the JS SDK is chosen based on the current active language of
    the request, taking a best guess. This can be customized using the
    ``LOCALE_FUNC`` setting, which takes either a callable or a path to a callable.
    This callable must take exactly one argument, the request, and return `a
    valid Facebook locale <http://developers.facebook.com/docs/
    internationalization/>`_ as a string, e.g. US English:

    .. code-block:: python

        SOCIALACCOUNT_PROVIDERS = {
            'facebook': {
                'LOCALE_FUNC': lambda request: 'en_US'
            }
        }

VERIFIED_EMAIL:
    It is not clear from the Facebook documentation whether or not the fact
    that the account is verified implies that the e-mail address is verified
    as well. For example, verification could also be done by phone or credit
    card. To be on the safe side, the default is to treat e-mail addresses
    from Facebook as unverified. But, if you feel that is too paranoid, then
    use this setting to mark them as verified. Due to lack of an official
    statement from the side of Facebook, attempts have been made to
    `reverse engineer the meaning of the verified flag <https://stackoverflow.com/questions/14280535/is-it-possible-to-check-if-an-email-is-confirmed-on-facebook>`_.
    Do know that by setting this to ``True`` you may be introducing a security
    risk.

VERSION:
    The Facebook Graph API version to use. The default is ``v2.4``.

App registration (get your key and secret here)
    A key and secret key can be obtained by
    `creating an app <https://developers.facebook.com/apps>`_.
    After registration you will need to make it available to the public.
    In order to do that your app first has to be
    `reviewed by Facebook <https://developers.facebook.com/docs/apps/review>`_.

Development callback URL
    Leave your App Domains empty and put ``http://localhost:8000`` in the
    section labeled ``Website with Facebook Login``. Note that you'll need to
    add your site's actual domain to this section once it goes live.


Firefox Accounts
----------------

The Firefox Accounts provider is currently limited to Mozilla relying services
but there is the intention, in the future, to allow third-party services to
delegate authentication. There is no committed timeline for this.

The provider is OAuth2 based. More info:
    https://developer.mozilla.org/en-US/Firefox_Accounts

Note: This is not the same as the Mozilla Persona provider below.

The following Firefox Accounts settings are available:

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'fxa': {
            'SCOPE': ['profile'],
            'OAUTH_ENDPOINT': 'https://oauth.accounts.firefox.com/v1',
            'PROFILE_ENDPOINT': 'https://profile.accounts.firefox.com/v1',
        }
    }

SCOPE:
    Requested OAuth2 scope. Default is ['profile'], which will work for
    applications on the Mozilla trusted whitelist. If your application is not
    on the whitelist, then define SCOPE to be ['profile:email', 'profile:uid'].

OAUTH_ENDPOINT:
    Explicitly set the OAuth2 endpoint. Default is the production endpoint
    "https://oauth.accounts.firefox.com/v1".

PROFILE_ENDPOINT:
    Explicitly set the profile endpoint. Default is the production endpoint
    and is "https://profile.accounts.firefox.com/v1".


Flickr
------

App registration (get your key and secret here)
    https://www.flickr.com/services/apps/create/

You can optionally specify the application permissions to use. If no ``perms``
value is set, the Flickr provider will use ``read`` by default.

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'flickr': {
            'AUTH_PARAMS': {
                'perms': 'write',
            }
        }
    }

More info:
    https://www.flickr.com/services/api/auth.oauth.html#authorization


GitHub
------

App registration (get your key and secret here)
    https://github.com/settings/applications/new

Development callback URL
    http://127.0.0.1:8000/accounts/github/login/callback/

If you want more than just read-only access to public data, specify the scope
as follows. See https://developer.github.com/v3/oauth/#scopes for details.

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'github': {
            'SCOPE': [
                'user',
                'repo',
                'read:org',
            ],
        }
    }

Enterprise Support
******************

If you use GitHub Enterprise add your server URL to your Django settings as
follows:

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'github': {
            'GITHUB_URL': 'https://your.github-server.domain',
        }
    }


GitLab
------

The GitLab provider works by default with https://gitlab.com. It allows you
to connect to your private GitLab server and use GitLab as an OAuth2
authentication provider as described in GitLab docs at
http://doc.gitlab.com/ce/integration/oauth_provider.html

The following GitLab settings are available, if unset https://gitlab.com will
be used.

GITLAB_URL:
    Override endpoint to request an authorization and access token. For your
    private GitLab server you use: ``https://your.gitlab.server.tld``

Example:

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'gitlab': {
            'GITLAB_URL': 'https://your.gitlab.server.tld',
        }
    }


Google
------

The Google provider is OAuth2 based.

More info:
    http://code.google.com/apis/accounts/docs/OAuth2.html#Registering


App registration
****************
Create a google app to obtain a key and secret through the developer console.

Google Developer Console
    https://console.developers.google.com/

After you create a project you will have to create a "Client ID" and fill in
some project details for the consent form that will be presented to the client.

Under "APIs & auth" go to "Credentials" and create a new Client ID. Probably
you will want a "Web application" Client ID. Provide your domain name or test
domain name in "Authorized JavaScript origins". Finally fill in
``http://127.0.0.1:8000/accounts/google/login/callback/`` in the
"Authorized redirect URI" field. You can fill multiple URLs, one for each test
domain. After creating the Client ID you will find all details for the Django
configuration on this page.

Users that login using the app will be presented a consent form. For this to
work additional information is required. Under "APIs & auth" go to
"Consent screen" and at least provide an email and product name.


Django configuration
********************
The app credentials are configured for your Django installation via the admin
interface. Create a new socialapp through ``/admin/socialaccount/socialapp/``.

Fill in the form as follows:

* Provider, "Google"
* Name, your pick, suggest "Google"
* Client id, is called "Client ID" by Google
* Secret key, is called "Client secret" by Google
* Key, is not needed, leave blank.

Optionally, you can specify the scope to use as follows:

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'google': {
            'SCOPE': [
                'profile',
                'email',
            ],
            'AUTH_PARAMS': {
                'access_type': 'online',
            }
        }
    }

By default, ``profile`` scope is required, and optionally ``email`` scope
depending on whether or not ``SOCIALACCOUNT_QUERY_EMAIL`` is enabled.


Instagram
---------

App registration (get your key and secret here)
    https://www.instagram.com/developer/clients/manage/

Development callback URL
    http://localhost:8000/accounts/instagram/login/callback/


Kakao
-----

App registration (get your key here)
    https://developers.kakao.com/apps

Development callback URL
    http://localhost:8000/accounts/kakao/login/callback/


Line
----

App registration (get your key and secret here)
    https://business.line.me

Development callback URL
    http://127.0.0.1:8000/accounts/line/login/callback/


LinkedIn
--------

The LinkedIn provider comes in two flavors: OAuth 1.0
(``allauth.socialaccount.providers.linkedin``) and OAuth 2.0
(``allauth.socialaccount.providers.linkedin_oauth2``).

You can specify the scope and fields to fetch as follows:

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'linkedin': {
            'SCOPE': [
                'r_emailaddress',
            ],
            'PROFILE_FIELDS': [
                'id',
                'first-name',
                'last-name',
                'email-address',
                'picture-url',
                'public-profile-url',
            ]
        }
    }

By default, ``r_emailaddress`` scope is required depending on whether or
not ``SOCIALACCOUNT_QUERY_EMAIL`` is enabled.

Note: if you are experiencing issues where it seems as if the scope has no
effect you may be using an old LinkedIn app that is not scope enabled.
Please refer to
``https://developer.linkedin.com/forum/when-will-old-apps-have-scope-parameter-enabled``
for more background information.

Furthermore, we have experienced trouble upgrading from OAuth 1.0 to OAuth 2.0
using the same app. Attempting to do so resulted in a weird error message when
fetching the access token::

    missing required parameters, includes an invalid parameter value, parameter more then once. : Unable to retrieve access token : authorization code not found

App registration (get your key and secret here)
    https://www.linkedin.com/secure/developer?newapp=

Authorized Redirect URLs (Oauth2)
*********************************
Add any you need (up to 200) consisting of:

    {``ACCOUNT_DEFAULT_HTTP_PROTOCOL``}://{hostname}{:optional_port}/{allauth_base_url}/linkedin_oauth2/login/callback/

For example when using the built-in django server and default settings:

    http://localhost:8000/accounts/linkedin_oauth2/login/callback/


Development "Accept" and "Cancel" redirect URL (Oauth 1.0a)
***********************************************************
    Leave the OAuth1 redirect URLs empty.

MailChimp (OAuth2)
------------------

MailChimp has a simple API for working with your own data and a `good library`_<commit_msg>Use consistent capitilazation for OAuth(2)<commit_after>Providers
=========

Most providers require you to sign up for a so called API client or app,
containing a client ID and API secret. You must add a ``SocialApp``
record per provider via the Django admin containing these app
credentials.

When creating the OAuth app on the side of the provider pay special
attention to the callback URL (sometimes also referred to as redirect
URL). If you do not configure this correctly, you will receive login
failures when attempting to log in, such as::

    An error occurred while attempting to login via your social network account.

Use a callback URL of the form::

    http://example.com/accounts/twitter/login/callback/
    http://example.com/accounts/soundcloud/login/callback/
    ...

For local development, use the following::

    http://127.0.0.1:8000/accounts/twitter/login/callback/


23andMe
-------

App registration (get your key and secret here)
    https://api.23andme.com/dev/

Development callback URL
    http://localhost:8000/accounts/23andme/login/callback/


500px
-----

App registration (get your key and secret here)
    https://500px.com/settings/applications

Development callback URL
    http://localhost:8000/accounts/500px/login/callback/


Amazon
------

Amazon requires secure OAuth callback URLs (``redirect_uri``), please
see the section on HTTPS about how this is handled.

App registration (get your key and secret here)
    http://login.amazon.com/manageApps

Development callback URL
    https://example.com/accounts/amazon/login/callback/


AngelList
---------

App registration (get your key and secret here)
    https://angel.co/api/oauth/clients

Development callback URL
    http://localhost:8000/accounts/angellist/login/callback/


Auth0
-----

App registration (get your key and secret here)
    https://manage.auth0.com/#/clients

Development callback URL
    http://localhost:8000/accounts/auth0/login/callback/


You'll need to specify the base URL for your Auth0 domain:

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'auth0': {
            'AUTH0_URL': 'https://your.auth0domain.auth0.com',
        }
    }


Authentiq
---------

Browse to https://www.authentiq.com/developers to get started.

App registration
    https://dashboard.authentiq.com/

Sign in or register with your Authentiq ID (select ``Download the app`` while signing in if you don't have Authentiq ID yet).

Development redirect URL
    http://localhost:8000/accounts/authentiq/login/callback/

While testing you can leave the ``Redirect URIs`` field empty in the dashboard. You can specify what identity details to request via the ``SCOPE`` parameter.

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'authentiq': {
          'SCOPE': ['email', 'aq:name']
        }
    }

Valid scopes include: ``email``, ``phone``, ``address``, ``aq:name``, ``aq:location``. The default is to request a user's name, and email address if ``SOCIALACCOUNT_QUERY_EMAIL=True``. You can request and require a verified email address by setting ``SOCIALACCOUNT_EMAIL_VERIFICATION=True`` and ``SOCIALACCOUNT_EMAIL_REQUIRED=True``.

Baidu
-----

The Baidu OAuth2 authentication documentation:
    http://developer.baidu.com/wiki/index.php?title=docs/oauth/refresh
    http://developer.baidu.com/wiki/index.php?title=docs/oauth/rest/file_data_apis_lista


Basecamp
--------

App registration (get your key and secret here)
    https://integrate.37signals.com/

The Basecamp OAuth2 authentication documentation
    https://github.com/basecamp/api/blob/master/sections/authentication.md#oauth-2

Development callback URL
    https://localhost:8000/accounts/basecamp/login/callback/


Battle.net
----------

The Battle.net OAuth2 authentication documentation
    https://dev.battle.net/docs/read/oauth

Register your app here (Mashery account required)
    https://dev.battle.net/apps/register

Development callback URL
    https://localhost:8000/accounts/battlenet/login/callback/

Note that in order to use battletags as usernames, you are expected to override
either the ``username`` field on your User model, or to pass a custom validator
which will accept the ``#`` character using the ``ACCOUNT_USERNAME_VALIDATORS``
setting. Such a validator is available in
``socialaccount.providers.battlenet.validators.BattletagUsernameValidator``.


Bitbucket
---------

App registration (get your key and secret here)
    https://bitbucket.org/account/user/{{yourusername}}/oauth-consumers/new

Make sure you select the Account:Read permission.

Development callback URL
    http://127.0.0.1:8000/accounts/bitbucket_oauth2/login/callback/

Note that Bitbucket calls the ``client_id`` *Key* in their user interface.
Don't get confused by that; use the *Key* value for your ``client_id`` field.


Box
---

App registration (get your key and secret here)
    https://app.box.com/developers/services/edit/

Development callback URL
    http://localhost:8000/accounts/box/login/callback/


Dataporten
----------

App registration (get your key and secret here)
    https://docs.dataporten.no/docs/gettingstarted/

Development callback URL
    http://localhost:8000/accounts/dataporten/login/callback


daum
----

App registration (get your key and secret here)
    https://developers.daum.net/console

Development callback URL
    http://127.0.0.1:8000/accounts/daum/login/callback/


DigitalOcean
------------

App registration (get your key and secret here)
    https://cloud.digitalocean.com/settings/applications

Development callback URL
    http://127.0.0.1:8000/accounts/digitalocean/login/callback/

With the acquired access token you will have read permissions on the API by
default.  If you also need write access specify the scope as follows.  See
https://developers.digitalocean.com/documentation/oauth/#scopes for details.

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'digitalocean': {
            'SCOPE': [
                'read write',
            ],
        }
    }


Discord
-------

App registration and management (get your key and secret here)
    https://discordapp.com/developers/applications/me

Make sure to Add Redirect URI to your application.

Development callback (redirect) URL
    http://127.0.0.1:8000/accounts/discord/login/callback/


Doximity
--------

Doximity OAuth2 implementation documentation
    https://www.doximity.com/developers/documentation#oauth

Request API keys here
    https://www.doximity.com/developers/api_signup

Development callback URL
    http://localhost:8000/accounts/doximity/login/callback/


Draugiem
--------

App registration (get your key and secret here)
    https://www.draugiem.lv/applications/dev/create/?type=4

Authentication documentation
    https://www.draugiem.lv/applications/dev/docs/passport/

Development callback URL
    http://localhost:8000/accounts/draugiem/login/callback/


Dropbox
-------

App registration (get your key and secret here)
    https://www.dropbox.com/developers/apps/

Development callback URL
    http://localhost:8000/accounts/dropbox/login/callback/

Note that Dropbox has deprecated version 1 of their API as of 28 June 2016. The original OAuth1 `dropbox` provider has been updated to OAuth2 and the newer URL endpoints for OAuth2 authentication and authorization.

The `dropbox_oauth2` provider is deprecated and will be removed after September 28, 2017.

Dwolla
------------

App registration (get your key and secret here)
    https://dashboard-uat.dwolla.com/applications

Development callback URL
    http://127.0.0.1:8000/accounts/dwolla/login/callback/


.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'dwolla': {
            'SCOPE': [
                'Send',
                'Transactions',
                'Funding',
                'AccountInfoFull',
            ],
            'ENVIROMENT':'sandbox',
        }
    }


Edmodo
------

Edmodo OAuth2 documentation
    https://developers.edmodo.com/edmodo-connect/edmodo-connect-overview-getting-started/

You can optionally specify additional permissions to use. If no ``SCOPE``
value is set, the Edmodo provider will use ``basic`` by default:

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'edmodo': {
            'SCOPE': [
                'basic',
                'read_groups',
                'read_connections',
                'read_user_email',
                'create_messages',
                'write_library_items',
            ]
        }
    }


Eve Online
----------

Register your application at ``https://developers.eveonline.com/applications/create``.
Note that if you have ``STORE_TOKENS`` enabled (the default), you will need to
set up your application to be able to request an OAuth scope. This means you
will need to set it as having "CREST Access". The least obtrusive scope is
"publicData".


Eventbrite
------------------

Log in and click your profile name in the top right navigation, then select
``Account Settings``. Choose ``App Management`` near the bottom of the left
navigation column. You can then click ``Create A New App`` on the upper left
corner.

App registration
    https://www.eventbrite.com/myaccount/apps/

Fill in the form with the following link

Development callback URL
    http://127.0.0.1:8000/accounts/eventbrite/login/callback/

for both the ``Application URL`` and ``OAuth Redirect URI``.


Evernote
--------

Register your OAuth2 application at ``https://dev.evernote.com/doc/articles/authentication.php``:

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'evernote': {
            'EVERNOTE_HOSTNAME': 'evernote.com'  # defaults to sandbox.evernote.com
        }
    }


Facebook
--------

For Facebook both OAuth2 and the Facebook Connect Javascript SDK are
supported. You can even mix the two.

An advantage of the Javascript SDK may be a more streamlined user
experience as you do not leave your site. Furthermore, you do not need
to worry about tailoring the login dialog depending on whether or not
you are using a mobile device. Yet, relying on Javascript may not be
everybody's cup of tea.

To initiate a login use:

.. code-block:: python

    {% load socialaccount %}
    {% providers_media_js %}
    <a href="{% provider_login_url "facebook" method="js_sdk" %}">Facebook Connect</a>

or:

.. code-block:: python

    {% load socialaccount %}
    <a href="{% provider_login_url "facebook" method="oauth2" %}">Facebook OAuth2</a>

The following Facebook settings are available:

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'facebook': {
            'METHOD': 'oauth2',
            'SCOPE': ['email', 'public_profile', 'user_friends'],
            'AUTH_PARAMS': {'auth_type': 'reauthenticate'},
            'INIT_PARAMS': {'cookie': True},
            'FIELDS': [
                'id',
                'email',
                'name',
                'first_name',
                'last_name',
                'verified',
                'locale',
                'timezone',
                'link',
                'gender',
                'updated_time',
            ],
            'EXCHANGE_TOKEN': True,
            'LOCALE_FUNC': 'path.to.callable',
            'VERIFIED_EMAIL': False,
            'VERSION': 'v2.4',
        }
    }

METHOD:
    Either ``js_sdk`` or ``oauth2``. The default is ``oauth2``.

SCOPE:
    By default, the ``email`` scope is required depending on whether or not
    ``SOCIALACCOUNT_QUERY_EMAIL`` is enabled.
    Apps using permissions beyond ``email``, ``public_profile`` and ``user_friends``
    require review by Facebook.
    See `Permissions with Facebook Login <https://developers.facebook.com/docs/facebook-login/permissions>`_
    for more information.

AUTH_PARAMS:
    Use ``AUTH_PARAMS`` to pass along other parameters to the ``FB.login``
    JS SDK call.

FIELDS:
    The fields to fetch from the Graph API ``/me/?fields=`` endpoint.
    For example, you could add the ``'friends'`` field in order to
    capture the user's friends that have also logged into your app using
    Facebook (requires ``'user_friends'`` scope).

EXCHANGE_TOKEN:
    The JS SDK returns a short-lived token suitable for client-side use. Set
    ``EXCHANGE_TOKEN = True`` to make a server-side request to upgrade to a
    long-lived token before storing in the ``SocialToken`` record. See
    `Expiration and Extending Tokens <https://developers.facebook.com/docs/facebook-login/access-tokens#extending>`_.

LOCALE_FUNC:
    The locale for the JS SDK is chosen based on the current active language of
    the request, taking a best guess. This can be customized using the
    ``LOCALE_FUNC`` setting, which takes either a callable or a path to a callable.
    This callable must take exactly one argument, the request, and return `a
    valid Facebook locale <http://developers.facebook.com/docs/
    internationalization/>`_ as a string, e.g. US English:

    .. code-block:: python

        SOCIALACCOUNT_PROVIDERS = {
            'facebook': {
                'LOCALE_FUNC': lambda request: 'en_US'
            }
        }

VERIFIED_EMAIL:
    It is not clear from the Facebook documentation whether or not the fact
    that the account is verified implies that the e-mail address is verified
    as well. For example, verification could also be done by phone or credit
    card. To be on the safe side, the default is to treat e-mail addresses
    from Facebook as unverified. But, if you feel that is too paranoid, then
    use this setting to mark them as verified. Due to lack of an official
    statement from the side of Facebook, attempts have been made to
    `reverse engineer the meaning of the verified flag <https://stackoverflow.com/questions/14280535/is-it-possible-to-check-if-an-email-is-confirmed-on-facebook>`_.
    Do know that by setting this to ``True`` you may be introducing a security
    risk.

VERSION:
    The Facebook Graph API version to use. The default is ``v2.4``.

App registration (get your key and secret here)
    A key and secret key can be obtained by
    `creating an app <https://developers.facebook.com/apps>`_.
    After registration you will need to make it available to the public.
    In order to do that your app first has to be
    `reviewed by Facebook <https://developers.facebook.com/docs/apps/review>`_.

Development callback URL
    Leave your App Domains empty and put ``http://localhost:8000`` in the
    section labeled ``Website with Facebook Login``. Note that you'll need to
    add your site's actual domain to this section once it goes live.


Firefox Accounts
----------------

The Firefox Accounts provider is currently limited to Mozilla relying services
but there is the intention, in the future, to allow third-party services to
delegate authentication. There is no committed timeline for this.

The provider is OAuth2 based. More info:
    https://developer.mozilla.org/en-US/Firefox_Accounts

Note: This is not the same as the Mozilla Persona provider below.

The following Firefox Accounts settings are available:

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'fxa': {
            'SCOPE': ['profile'],
            'OAUTH_ENDPOINT': 'https://oauth.accounts.firefox.com/v1',
            'PROFILE_ENDPOINT': 'https://profile.accounts.firefox.com/v1',
        }
    }

SCOPE:
    Requested OAuth2 scope. Default is ['profile'], which will work for
    applications on the Mozilla trusted whitelist. If your application is not
    on the whitelist, then define SCOPE to be ['profile:email', 'profile:uid'].

OAUTH_ENDPOINT:
    Explicitly set the OAuth2 endpoint. Default is the production endpoint
    "https://oauth.accounts.firefox.com/v1".

PROFILE_ENDPOINT:
    Explicitly set the profile endpoint. Default is the production endpoint
    and is "https://profile.accounts.firefox.com/v1".


Flickr
------

App registration (get your key and secret here)
    https://www.flickr.com/services/apps/create/

You can optionally specify the application permissions to use. If no ``perms``
value is set, the Flickr provider will use ``read`` by default.

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'flickr': {
            'AUTH_PARAMS': {
                'perms': 'write',
            }
        }
    }

More info:
    https://www.flickr.com/services/api/auth.oauth.html#authorization


GitHub
------

App registration (get your key and secret here)
    https://github.com/settings/applications/new

Development callback URL
    http://127.0.0.1:8000/accounts/github/login/callback/

If you want more than just read-only access to public data, specify the scope
as follows. See https://developer.github.com/v3/oauth/#scopes for details.

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'github': {
            'SCOPE': [
                'user',
                'repo',
                'read:org',
            ],
        }
    }

Enterprise Support
******************

If you use GitHub Enterprise add your server URL to your Django settings as
follows:

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'github': {
            'GITHUB_URL': 'https://your.github-server.domain',
        }
    }


GitLab
------

The GitLab provider works by default with https://gitlab.com. It allows you
to connect to your private GitLab server and use GitLab as an OAuth2
authentication provider as described in GitLab docs at
http://doc.gitlab.com/ce/integration/oauth_provider.html

The following GitLab settings are available, if unset https://gitlab.com will
be used.

GITLAB_URL:
    Override endpoint to request an authorization and access token. For your
    private GitLab server you use: ``https://your.gitlab.server.tld``

Example:

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'gitlab': {
            'GITLAB_URL': 'https://your.gitlab.server.tld',
        }
    }


Google
------

The Google provider is OAuth2 based.

More info:
    http://code.google.com/apis/accounts/docs/OAuth2.html#Registering


App registration
****************
Create a google app to obtain a key and secret through the developer console.

Google Developer Console
    https://console.developers.google.com/

After you create a project you will have to create a "Client ID" and fill in
some project details for the consent form that will be presented to the client.

Under "APIs & auth" go to "Credentials" and create a new Client ID. Probably
you will want a "Web application" Client ID. Provide your domain name or test
domain name in "Authorized JavaScript origins". Finally fill in
``http://127.0.0.1:8000/accounts/google/login/callback/`` in the
"Authorized redirect URI" field. You can fill multiple URLs, one for each test
domain. After creating the Client ID you will find all details for the Django
configuration on this page.

Users that login using the app will be presented a consent form. For this to
work additional information is required. Under "APIs & auth" go to
"Consent screen" and at least provide an email and product name.


Django configuration
********************
The app credentials are configured for your Django installation via the admin
interface. Create a new socialapp through ``/admin/socialaccount/socialapp/``.

Fill in the form as follows:

* Provider, "Google"
* Name, your pick, suggest "Google"
* Client id, is called "Client ID" by Google
* Secret key, is called "Client secret" by Google
* Key, is not needed, leave blank.

Optionally, you can specify the scope to use as follows:

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'google': {
            'SCOPE': [
                'profile',
                'email',
            ],
            'AUTH_PARAMS': {
                'access_type': 'online',
            }
        }
    }

By default, ``profile`` scope is required, and optionally ``email`` scope
depending on whether or not ``SOCIALACCOUNT_QUERY_EMAIL`` is enabled.


Instagram
---------

App registration (get your key and secret here)
    https://www.instagram.com/developer/clients/manage/

Development callback URL
    http://localhost:8000/accounts/instagram/login/callback/


Kakao
-----

App registration (get your key here)
    https://developers.kakao.com/apps

Development callback URL
    http://localhost:8000/accounts/kakao/login/callback/


Line
----

App registration (get your key and secret here)
    https://business.line.me

Development callback URL
    http://127.0.0.1:8000/accounts/line/login/callback/


LinkedIn
--------

The LinkedIn provider comes in two flavors: OAuth 1.0
(``allauth.socialaccount.providers.linkedin``) and OAuth 2.0
(``allauth.socialaccount.providers.linkedin_oauth2``).

You can specify the scope and fields to fetch as follows:

.. code-block:: python

    SOCIALACCOUNT_PROVIDERS = {
        'linkedin': {
            'SCOPE': [
                'r_emailaddress',
            ],
            'PROFILE_FIELDS': [
                'id',
                'first-name',
                'last-name',
                'email-address',
                'picture-url',
                'public-profile-url',
            ]
        }
    }

By default, ``r_emailaddress`` scope is required depending on whether or
not ``SOCIALACCOUNT_QUERY_EMAIL`` is enabled.

Note: if you are experiencing issues where it seems as if the scope has no
effect you may be using an old LinkedIn app that is not scope enabled.
Please refer to
``https://developer.linkedin.com/forum/when-will-old-apps-have-scope-parameter-enabled``
for more background information.

Furthermore, we have experienced trouble upgrading from OAuth 1.0 to OAuth 2.0
using the same app. Attempting to do so resulted in a weird error message when
fetching the access token::

    missing required parameters, includes an invalid parameter value, parameter more then once. : Unable to retrieve access token : authorization code not found

App registration (get your key and secret here)
    https://www.linkedin.com/secure/developer?newapp=

Authorized Redirect URLs (OAuth2)
*********************************
Add any you need (up to 200) consisting of:

    {``ACCOUNT_DEFAULT_HTTP_PROTOCOL``}://{hostname}{:optional_port}/{allauth_base_url}/linkedin_oauth2/login/callback/

For example when using the built-in django server and default settings:

    http://localhost:8000/accounts/linkedin_oauth2/login/callback/


Development "Accept" and "Cancel" redirect URL (OAuth 1.0a)
***********************************************************
    Leave the OAuth1 redirect URLs empty.

MailChimp (OAuth2)
------------------

MailChimp has a simple API for working with your own data and a `good library`_
{'fraction_non_alphanumeric': 0.1089815858699737, 'fraction_numerical': 0.011649755730928222, 'mean_word_length': 2.9699868363317243, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 112, 'lorem ipsum': 0, 'www.': 22, 'xml': 0}, 'pii_count': 20, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 86, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4581165', 'n_tokens_mistral': 13546, 'n_tokens_neox': 12604, 'n_words': 4485}