2
Trello OAuth1 backend, docs at:
3
https://python-social-auth.readthedocs.io/en/latest/backends/trello.html
5
from .oauth import BaseOAuth1
8
class TrelloOAuth(BaseOAuth1):
10
"""Trello OAuth authentication backend"""
13
AUTHORIZATION_URL = 'https://trello.com/1/OAuthAuthorizeToken'
14
REQUEST_TOKEN_URL = 'https://trello.com/1/OAuthGetRequestToken'
15
ACCESS_TOKEN_URL = 'https://trello.com/1/OAuthGetAccessToken'
18
('username', 'username'),
20
('fullName', 'fullName')
23
def get_user_details(self, response):
24
"""Return user details from Trello account"""
25
fullname, first_name, last_name = self.get_user_names(
26
response.get('fullName')
28
return {'username': response.get('username'),
29
'email': response.get('email'),
31
'first_name': first_name,
32
'last_name': last_name}
34
def user_data(self, access_token):
35
"""Return user data provided"""
36
url = 'https://trello.com/1/members/me'
38
return self.get_json(url, auth=self.oauth_auth(access_token))
42
def auth_extra_arguments(self):
44
'name': self.setting('APP_NAME', ''),
45
# trello default expiration is '30days'
46
'expiration': self.setting('EXPIRATION', 'never')