rest_framework_oauth/authentication.py
def authenticate(self, request):
        """
        Returns two-tuple of (user, token) if authentication succeeds,
        or None otherwise.
        """

        auth = get_authorization_header(request).split()

        if len(auth) == 1:
            msg = 'Invalid bearer header. No credentials provided.'
            raise exceptions.AuthenticationFailed(msg)
        elif len(auth) > 2:
            msg = 'Invalid bearer header. Token string should not contain spaces.'
            raise exceptions.AuthenticationFailed(msg)

        if auth and auth[0].lower() == b'bearer':
            access_token = auth[1]
        elif 'access_token' in request.POST:
            access_token = request.POST['access_token']
        elif 'access_token' in request.GET and self.allow_query_params_token:
            access_token = request.GET['access_token']
        else:
            return None

        return self.authenticate_credentials(request, access_token)
def authenticate(self, request):
        """
        Returns two-tuple of (user, token) if authentication succeeds,
        or None otherwise.
        """

        auth = get_authorization_header(request).split()

        if len(auth) == 1:
            msg = 'Invalid bearer header. No credentials provided.'
            raise exceptions.AuthenticationFailed(msg)
        elif len(auth) > 2:
            msg = 'Invalid bearer header. Token string should not contain spaces.'
            raise exceptions.AuthenticationFailed(msg)

        if auth and auth[0].lower() == b'bearer':
            access_token = auth[1]
        elif 'access_token' in request.POST:
            access_token = request.POST['access_token']
        elif 'access_token' in request.GET and self.allow_query_params_token:
            access_token = request.GET['access_token']
        else:
            return None

        return self.authenticate_credentials(request, access_token)
def authenticate ( self , request ) : auth = get_authorization_header ( request ) . split ( ) if len ( auth ) == 1 : msg = 'Invalid bearer header. No credentials provided.' raise exceptions . AuthenticationFailed ( msg ) elif len ( auth ) > 2 : msg = 'Invalid bearer header. Token string should not contain spaces.' raise exceptions . AuthenticationFailed ( msg ) if auth and auth [ 0 ] . lower ( ) == b'bearer' : access_token = auth [ 1 ] elif 'access_token' in request . POST : access_token = request . POST [ 'access_token' ] elif 'access_token' in request . GET and self . allow_query_params_token : access_token = request . GET [ 'access_token' ] else : return None return self . authenticate_credentials ( request , access_token )
Returns two-tuple of (user, token) if authentication succeeds,
        or None otherwise.
Returns two - tuple of ( user token ) if authentication succeeds or None otherwise .