MCPcopy Create free account
hub / github.com/authlib/authlib / InvalidClientError

Class InvalidClientError

authlib/oauth2/rfc6749/errors.py:81–110  ·  view source on GitHub ↗

Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authentication method). The authorization server MAY return an HTTP 401 (Unauthorized) status code to indicate which HTTP authentication schemes are supported. If the client at

Source from the content-addressed store, hash-verified

79
80
81class InvalidClientError(OAuth2Error):
82 """Client authentication failed (e.g., unknown client, no
83 client authentication included, or unsupported
84 authentication method). The authorization server MAY
85 return an HTTP 401 (Unauthorized) status code to indicate
86 which HTTP authentication schemes are supported. If the
87 client attempted to authenticate via the "Authorization"
88 request header field, the authorization server MUST
89 respond with an HTTP 401 (Unauthorized) status code and
90 include the "WWW-Authenticate" response header field
91 matching the authentication scheme used by the client.
92
93 :rfc:`6749#section-5.2`
94 """
95
96 error = "invalid_client"
97 status_code = 400
98
99 def get_headers(self):
100 headers = super().get_headers()
101 if self.status_code == 401:
102 error_description = self.get_error_description()
103 # safe escape
104 error_description = error_description.replace('"', "|")
105 extras = [
106 f'error="{self.error}"',
107 f'error_description="{error_description}"',
108 ]
109 headers.append(("WWW-Authenticate", "Basic " + ", ".join(extras)))
110 return headers
111
112
113class InvalidGrantError(OAuth2Error):

Callers 11

authenticateMethod · 0.70
_validate_clientFunction · 0.70
__call__Method · 0.50
verify_claimsMethod · 0.50
authenticate_clientMethod · 0.50
extract_assertionMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected