2
Moves OAuth2 backend, docs at:
3
https://dev.moves-app.com/docs/authentication
5
Written by Avi Alkalay <avi at unix dot sh>
6
Certified to work with Django 1.6
8
from .oauth import BaseOAuth2
11
class MovesOAuth2(BaseOAuth2):
12
"""Moves OAuth authentication backend"""
15
AUTHORIZATION_URL = 'https://api.moves-app.com/oauth/v1/authorize'
16
ACCESS_TOKEN_URL = 'https://api.moves-app.com/oauth/v1/access_token'
17
ACCESS_TOKEN_METHOD = 'POST'
19
('refresh_token', 'refresh_token', True),
20
('expires_in', 'expires'),
23
def get_user_details(self, response):
24
"""Return user details Moves account"""
25
return {'username': str(response.get('user_id'))}
27
def user_data(self, access_token, *args, **kwargs):
28
"""Loads user data from service"""
29
return self.get_json('https://api.moves-app.com/api/1.1/user/profile',
30
params={'access_token': access_token})