Debian Codegraph @

docs/socialaccount/providers/openid_connect.rst

raw
1 OpenID Connect
2 --------------
3
4 The OpenID Connect provider provides access to multiple independent OpenID
5 Connect (sub)providers. You configure these (sub)providers by adding apps to the
6 configuration of the overall OpenID connect provider. Each app represents a
7 standalone OpenID Connect provider:
8
9 .. code-block:: python
10
11 SOCIALACCOUNT_PROVIDERS = {
12 "openid_connect": {
13 # Optional PKCE defaults to False, but may be required by your provider
14 # Can be set globally, or per app (settings).
15 "OAUTH_PKCE_ENABLED": True,
16 "APPS": [
17 {
18 "provider_id": "my-server",
19 "name": "My Login Server",
20 "client_id": "your.service.id",
21 "secret": "your.service.secret",
22 "settings": {
23 # When enabled, an additional call to the userinfo
24 # endpoint takes place. The data returned is stored in
25 # `SocialAccount.extra_data`. When disabled, the (decoded) ID
26 # token payload is used instead.
27 "fetch_userinfo": True,
28 "oauth_pkce_enabled": True,
29 "server_url": "https://my.server.example.com",
30 # Optional token endpoint authentication method.
31 # May be one of "client_secret_basic", "client_secret_post"
32 # If omitted, a method from the the server's
33 # token auth methods list is used
34 "token_auth_method": "client_secret_basic",
35 # The field to be used as the account ID.
36 "uid_field": "sub",
37 },
38 },
39 {
40 "provider_id": "other-server",
41 "name": "Other Login Server",
42 "client_id": "your.other.service.id",
43 "secret": "your.other.service.secret",
44 "settings": {
45 "server_url": "https://other.server.example.com",
46 },
47 },
48 ]
49 }
50 }
51
52 This configuration example will create two independent provider instances,
53 ``My Login Server`` and ``Other Login Server``.
54
55 The OpenID Connect callback URL for each configured server is at
56 ``/accounts/oidc/{id}/login/callback/`` where ``{id}`` is the configured app's
57 ``provider_id`` value (``my-server`` or ``other-server`` in the above example).
58
59 Authentication Request's Optional Parameters
60 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
61
62 See :ref:`oauth2-authentication-optional-parameters`.