sanic_jwt/authentication.py
def _get_token_from_headers(self, request, refresh_token):
        """
        Extract the token if present inside the headers of a request.
        """
        header = request.headers.get(self.config.authorization_header(), None)

        if header is None:
            return None

        else:
            header_prefix_key = "authorization_header_prefix"
            header_prefix = getattr(self.config, header_prefix_key)
            if header_prefix():
                try:
                    prefix, token = header.split(" ")
                    if prefix != header_prefix():
                        raise Exception

                except Exception:
                    raise exceptions.InvalidAuthorizationHeader()

            else:
                token = header

            if refresh_token:
                token = request.json.get(self.config.refresh_token_name())

            return token

        Extract the token if present inside the headers of a request.
        
Extract the token if present inside the headers of a request.
Extract the token if present inside the headers of a request .
def _get_token_from_headers(self, request, refresh_token):
        header = request.headers.get(self.config.authorization_header(), None)
        if header is None:
            return None
        else:
            header_prefix_key = "authorization_header_prefix"
            header_prefix = getattr(self.config, header_prefix_key)
            if header_prefix():
                try:
                    prefix, token = header.split(" ")
                    if prefix != header_prefix():
                        raise Exception
                except Exception:
                    raise exceptions.InvalidAuthorizationHeader()
            else:
                token = header
            if refresh_token:
                token = request.json.get(self.config.refresh_token_name())
            return token
def _get_token_from_headers ( self , request , refresh_token ) : header = request . headers . get ( self . config . authorization_header ( ) , None ) if header is None : return None else : header_prefix_key = "authorization_header_prefix" header_prefix = getattr ( self . config , header_prefix_key ) if header_prefix ( ) : try : prefix , token = header . split ( " " ) if prefix != header_prefix ( ) : raise Exception except Exception : raise exceptions . InvalidAuthorizationHeader ( ) else : token = header if refresh_token : token = request . json . get ( self . config . refresh_token_name ( ) ) return token
Extract the token if present inside the headers of a request.
Extract the token if present inside the headers of a request .
"""
        Extract the token if present inside the headers of a request.
        """
self
request
refresh_token