def login(self, fxa_account): log.debug('calling login/start to generate fxa_state') response = self.client.get( '/api/v3/accounts/login/start/', allow_redirects=True) params = dict(urlparse.parse_qsl(response.url)) fxa_state = params['state'] log.debug('Get browser id session token') fxa_session = helpers.get_fxa_client().login( email=fxa_account.email, password=fxa_account.password) oauth_client = fxa_oauth.Client( client_id=FXA_CONFIG['client_id'], client_secret=FXA_CONFIG['client_secret'], server_url=FXA_CONFIG['oauth_host']) log.debug('convert browser id session token into oauth code') oauth_code = oauth_client.authorize_code(fxa_session, scope='profile') # Now authenticate the user, this will verify the user on the server response = self.client.get( '/api/v3/accounts/authenticate/', params={ 'state': fxa_state, 'code': oauth_code, }, name='/api/v3/accounts/authenticate/?state=:state' )
def login(self, account): log.debug('creating fxa account') fxa_account, email_account = helpers.get_fxa_account() log.debug('calling login/start to generate fxa_state') response = self.client.get( reverse('accounts.login_start'), allow_redirects=False) params = dict(urlparse.parse_qsl(response.headers['Location'])) fxa_state = params['state'] log.debug('Get browser id session token') fxa_session = helpers.get_fxa_client().login( email=fxa_account.email, password=fxa_account.password) oauth_client = fxa_oauth.Client( client_id=FXA_CONFIG['client_id'], client_secret=FXA_CONFIG['client_secret'], server_url=FXA_CONFIG['oauth_host']) log.debug('convert browser id session token into oauth code') oauth_code = oauth_client.authorize_code(fxa_session, scope='profile') # Now authenticate the user, this will verify the user on the response = self.client.get( reverse('accounts.authenticate'), params={ 'state': fxa_state, 'code': oauth_code, } )
def login(self, fxa_account): log.debug('calling login/start to generate fxa_state') response = self.client.get('/api/v3/accounts/login/start/', allow_redirects=True) params = dict(urlparse.parse_qsl(response.url)) fxa_state = params['state'] log.debug('Get browser id session token') fxa_session = helpers.get_fxa_client().login( email=fxa_account.email, password=fxa_account.password) oauth_client = fxa_oauth.Client( client_id=FXA_CONFIG['client_id'], client_secret=FXA_CONFIG['client_secret'], server_url=FXA_CONFIG['oauth_host']) log.debug('convert browser id session token into oauth code') oauth_code = oauth_client.authorize_code(fxa_session, scope='profile') # Now authenticate the user, this will verify the user on the server response = self.client.get( '/api/v3/accounts/authenticate/', params={ 'state': fxa_state, 'code': oauth_code, }, name='/api/v3/accounts/authenticate/?state=:state')
def login(self, account): log.debug('creating fxa account') fxa_account, email_account = helpers.get_fxa_account() log.debug('calling login/start to generate fxa_state') response = self.client.get(reverse('accounts.login_start'), allow_redirects=False) params = dict(urlparse.parse_qsl(response.headers['Location'])) fxa_state = params['state'] log.debug('Get browser id session token') fxa_session = helpers.get_fxa_client().login( email=fxa_account.email, password=fxa_account.password) oauth_client = fxa_oauth.Client( client_id=FXA_CONFIG['client_id'], client_secret=FXA_CONFIG['client_secret'], server_url=FXA_CONFIG['oauth_host']) log.debug('convert browser id session token into oauth code') oauth_code = oauth_client.authorize_code(fxa_session, scope='profile') # Now authenticate the user, this will verify the user on the response = self.client.get(reverse('accounts.authenticate'), params={ 'state': fxa_state, 'code': oauth_code, })