/usr/lib/python3/dist-packages/social/backends/deezer.py is in python3-social-auth 1:0.2.21+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | """
Deezer backend, docs at:
https://developers.deezer.com/api/oauth
https://developers.deezer.com/api/permissions
"""
from six.moves.urllib.parse import parse_qsl
from social.backends.oauth import BaseOAuth2
class DeezerOAuth2(BaseOAuth2):
"""Deezer OAuth2 authentication backend"""
name = 'deezer'
ID_KEY = 'name'
AUTHORIZATION_URL = 'https://connect.deezer.com/oauth/auth.php'
ACCESS_TOKEN_URL = 'https://connect.deezer.com/oauth/access_token.php'
ACCESS_TOKEN_METHOD = 'POST'
SCOPE_SEPARATOR = ','
REDIRECT_STATE = False
def auth_complete_params(self, state=None):
client_id, client_secret = self.get_key_and_secret()
return {
'app_id': client_id,
'secret': client_secret,
'code': self.data.get('code')
}
def request_access_token(self, *args, **kwargs):
response = self.request(*args, **kwargs)
return dict(parse_qsl(response.text))
def get_user_details(self, response):
"""Return user details from Deezer account"""
fullname, first_name, last_name = self.get_user_names(
first_name=response.get('firstname'),
last_name=response.get('lastname')
)
return {'username': response.get('name'),
'email': response.get('email'),
'fullname': fullname,
'first_name': first_name,
'last_name': last_name}
def user_data(self, access_token, *args, **kwargs):
"""Loads user data from service"""
return self.get_json('http://api.deezer.com/user/me', params={
'access_token': access_token
})
|