INNER CODE UNIT · Python

_get_jwt_from_headers

IndominusByte/fastapi-jwt-auth · fastapi_jwt_auth/auth_jwt.py:39

    def _get_jwt_from_headers(self,auth: str) -> "AuthJWT":
        """
        Get token from the headers

        :param auth: value from HeaderName
        """
        header_name, header_type = self._header_name, self._header_type

        parts = auth.split()

        # Make sure the header is in a valid format that we are expecting, ie
        if not header_type:
            # <HeaderName>: <JWT>
            if len(parts) != 1:
                msg = "Bad {} header. Expected value '<JWT>'".format(header_name)
                raise InvalidHeaderError(status_code=422,message=msg)
            self._token = parts[0]
        else:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…