@csrf_exempt
@require_POST
@social_utils.strategy('social:complete')
def login_oauth_token(request, backend):
 warnings.warn('Please use AccessTokenExchangeView instead.', DeprecationWarning)
 backend = request.backend
 if (isinstance(backend, social_oauth.BaseOAuth1) or isinstance(backend, social_oauth.BaseOAuth2)):
  if ('access_token' in request.POST):
   request.session[pipeline.AUTH_ENTRY_KEY] = pipeline.AUTH_ENTRY_LOGIN_API
   user = None
   try:
    user = backend.do_auth(request.POST['access_token'])
   except (HTTPError, AuthException):
    pass
   if (user and isinstance(user, User)):
    login(request, user)
    return JsonResponse(status=204)
   else:
    request.social_strategy.clean_partial_pipeline()
    return JsonResponse({'error': 'invalid_token'}, status=401)
  else:
   return JsonResponse({'error': 'invalid_request'}, status=400)
 raise Http404

@ csrf_exempt @ require_POST @ social_utils . strategy ( 'social:complete' ) def login_oauth_token ( request , backend ) : warnings . warn ( 'Please use AccessTokenExchangeView instead.' , DeprecationWarning ) backend = request . backend if ( isinstance ( backend , social_oauth . BaseOAuth1 ) or isinstance ( backend , social_oauth . BaseOAuth2 ) ) : if ( 'access_token' in request . POST ) : request . session [ pipeline . AUTH_ENTRY_KEY ] = pipeline . AUTH_ENTRY_LOGIN_API user = None try : user = backend . do_auth ( request . POST [ 'access_token' ] ) except ( HTTPError , AuthException ) : pass if ( user and isinstance ( user , User ) ) : login ( request , user ) return JsonResponse ( status = 204 ) else : request . social_strategy . clean_partial_pipeline ( ) return JsonResponse ( { 'error' : 'invalid_token' } , status = 401 ) else : return JsonResponse ( { 'error' : 'invalid_request' } , status = 400 ) raise Http404
authenticate the client using an oauth access token by using the token to retrieve information from a third party and matching that information to an existing user .