/usr/lib/python2.7/dist-packages/social/backends/mapmyfitness.py is in python-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 | """
MapMyFitness OAuth2 backend, docs at:
http://psa.matiasaguirre.net/docs/backends/mapmyfitness.html
"""
from social.backends.oauth import BaseOAuth2
class MapMyFitnessOAuth2(BaseOAuth2):
"""MapMyFitness OAuth authentication backend"""
name = 'mapmyfitness'
AUTHORIZATION_URL = 'https://www.mapmyfitness.com/v7.0/oauth2/authorize'
ACCESS_TOKEN_URL = \
'https://oauth2-api.mapmyapi.com/v7.0/oauth2/access_token'
REQUEST_TOKEN_METHOD = 'POST'
ACCESS_TOKEN_METHOD = 'POST'
REDIRECT_STATE = False
EXTRA_DATA = [
('refresh_token', 'refresh_token'),
]
def auth_headers(self):
key = self.get_key_and_secret()[0]
return {
'Api-Key': key
}
def get_user_id(self, details, response):
return response['id']
def get_user_details(self, response):
first = response.get('first_name', '')
last = response.get('last_name', '')
full = (first + last).strip()
return {
'username': response['username'],
'email': response['email'],
'fullname': full,
'first_name': first,
'last_name': last,
}
def user_data(self, access_token, *args, **kwargs):
key = self.get_key_and_secret()[0]
url = 'https://oauth2-api.mapmyapi.com/v7.0/user/self/'
headers = {
'Authorization': 'Bearer {0}'.format(access_token),
'Api-Key': key
}
return self.get_json(url, headers=headers)
|