Debian Codegraph @

src/auth0/authentication/social.py

raw symbols SCIP
1 from typing import Any
2
3 from .base import AuthenticationBase
4
5
6 class Social(AuthenticationBase):
7
8 """Social provider's endpoints.
9
10 Args:
11 domain (str): Your auth0 domain (e.g: my-domain.us.auth0.com)
12 """
13
14 def login(self, access_token: str, connection: str, scope: str = "openid") -> Any:
15 """Login using a social provider's access token
16
17 Given the social provider's access_token and the connection specified,
18 it will do the authentication on the provider and return a dict with
19 the access_token and id_token. Currently, this endpoint only works for
20 Facebook, Google, Twitter and Weibo.
21
22 Args:
23 access_token (str): social provider's access_token.
24
25 connection (str): connection type (e.g: 'facebook')
26
27 Returns:
28 A dict with 'access_token' and 'id_token' keys.
29 """
30
31 return self.post(
32 f"{self.protocol}://{self.domain}/oauth/access_token",
33 data={
34 "client_id": self.client_id,
35 "access_token": access_token,
36 "connection": connection,
37 "scope": scope,
38 },
39 )