Debian Codegraph @

docs/socialaccount/providers/openid.rst

raw
1 OpenID
2 ------
3
4 The OpenID provider requires dependencies that are not installed by
5 default. Install using::
6
7 $ pip install "django-allauth[socialaccount,openid]"
8
9 The provider does not require any settings per se. However, a typical OpenID
10 login page presents the user with a predefined list of OpenID providers and
11 allows the user to input their own OpenID identity URL in case their provider is
12 not listed by default. The list of providers displayed by the builtin templates
13 can be configured as follows:
14
15 .. code-block:: python
16
17 SOCIALACCOUNT_PROVIDERS = {
18 'openid': {
19 'SERVERS': [
20 {
21 'id': 'yahoo',
22 'name': 'Yahoo',
23 'openid_url': 'http://me.yahoo.com',
24 },
25 {
26 'id': 'hyves',
27 'name': 'Hyves',
28 'openid_url': 'http://hyves.nl',
29 },
30 {
31 'id': 'google',
32 'name': 'Google',
33 'openid_url': 'https://www.google.com/accounts/o8/id',
34 },
35 ]
36 }
37 }
38
39 You can manually specify extra_data you want to request from server as follows::
40
41 SOCIALACCOUNT_PROVIDERS = \
42 { 'openid':
43 { 'SERVERS':
44 [
45 {
46 'id': 'mojeid',
47 'name': 'MojeId',
48 'openid_url': 'https://mojeid.cz/endpoint/',
49 'extra_attributes': [
50 ('phone', ''http://axschema.org/contact/phone/default', False),
51 ('birth_date', 'http://axschema.org/birthDate', False),
52 ]
53 },
54 ]
55 }
56 }
57
58 Attributes are in form (id, name, required) where id is key in extra_data field of socialaccount,
59 name is identifier of requested attribute and required specifies whether attribute is required.
60
61 If you want to manually include login links yourself, you can use the
62 following template tag:
63
64 .. code-block:: python
65
66 {% load socialaccount %}
67 <a href="{% provider_login_url "openid" openid="https://www.google.com/accounts/o8/id" next="/success/url/" %}">Google</a>
68
69 The OpenID provider can be forced to operate in stateless mode as follows::
70
71 SOCIALACCOUNT_PROVIDERS = \
72 { 'openid':
73 { 'SERVERS':
74 [
75 {
76 'id': 'steam',
77 'name': 'Steam',
78 'openid_url': 'https://steamcommunity.com/openid',
79 'stateless': True,
80 },
81 ]
82 }
83 }