<commit_before>"""
Live OAuth2 backend, docs at:
    http://psa.matiasaguirre.net/docs/backends/live.html
"""
from social.backends.oauth import BaseOAuth2


class LiveOAuth2(BaseOAuth2):
    name = 'live'
    AUTHORIZATION_URL = 'https://login.live.com/oauth20_authorize.srf'
    ACCESS_TOKEN_URL = 'https://login.live.com/oauth20_token.srf'
    ACCESS_TOKEN_METHOD = 'POST'
    SCOPE_SEPARATOR = ','
    DEFAULT_SCOPE = ['wl.basic', 'wl.emails']
    EXTRA_DATA = [
        ('id', 'id'),
        ('access_token', 'access_token'),
        ('reset_token', 'reset_token'),
        ('expires', 'expires'),
        ('email', 'email'),
        ('first_name', 'first_name'),
        ('last_name', 'last_name'),
    ]

    def get_user_details(self, response):
        """Return user details from Live Connect account"""
        return {'username': response.get('name'),
                'email': response.get('emails', {}).get('account', ''),
                'first_name': response.get('first_name'),
                'last_name': response.get('last_name')}<commit_msg>updated live connection for better support<commit_after>"""
Live OAuth2 backend, docs at:
    http://psa.matiasaguirre.net/docs/backends/live.html
"""
from social.backends.oauth import BaseOAuth2


class LiveOAuth2(BaseOAuth2):
    name = 'live'
    AUTHORIZATION_URL = 'https://login.live.com/oauth20_authorize.srf'
    ACCESS_TOKEN_URL = 'https://login.live.com/oauth20_token.srf'
    ACCESS_TOKEN_METHOD = 'POST'
    SCOPE_SEPARATOR = ','
    DEFAULT_SCOPE = ['wl.basic', 'wl.emails']
    EXTRA_DATA = [
        ('id', 'id'),
        ('access_token', 'access_token'),
        ('authentication_token', 'authentication_token'),
        ('refresh_token', 'refresh_token'),
        ('expires_in', 'expires'),
        ('email', 'email'),
        ('first_name', 'first_name'),
        ('last_name', 'last_name'),
        ('token_type', 'token_type'),
    ]

    def extra_data(self, user, uid, response, details):
        extra_data = super(LiveOAuth2, self).extra_data(user, uid, response, details)
        extra_data['email'] = response.get('emails', {}).get('account')
        return extra_data

    def get_user_details(self, response):
        """Return user details from Live Connect account"""
        return {'username': response.get('name'),
                'email': response.get('emails', {}).get('account', ''),
                'first_name': response.get('first_name'),
                'last_name': response.get('last_name')}
{'fraction_non_alphanumeric': 0.16646610509426393, 'fraction_numerical': 0.00681909346169274, 'mean_word_length': 3.1359867330016584, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6055238', 'n_tokens_mistral': 819, 'n_tokens_neox': 797, 'n_words': 145}