INNER CODE UNIT · Python

__init__

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

    def __init__(self,req: Request = None, res: Response = None):
        """
        Get jwt header from incoming request or get
        request and response object if jwt in the cookie

        :param req: all incoming request
        :param res: response from endpoint
        """
        if res and self.jwt_in_cookies:
            self._response = res

        if req:
            # get request object when cookies in token location
            if self.jwt_in_cookies:
                self._request = req
            # get jwt in headers when headers in token location
            if self.jwt_in_headers:
                auth = req.headers.get(self._header_name.lower())

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…