[docs]defintrospect_token(introspection_endpoint:str,token:str,auth:ClientAuthenticationMethod,token_type_hint:Union[str,None]=None,)->Union[TokenIntrospectionSuccessResponse,TokenIntrospectionErrorResponse]:""" Introspect the given token at the OP. :param introspection_endpoint: The token introspection endpoint of the OP. :param token: The token to introspect. :param auth: Method with which this request is authenticated to the OP. :param token_type_hint: Which type of token this is e.g. `refresh_token` or `access_token`. :return: The OPs response """request=TokenIntrospectionRequest(token=token,token_type_hint=token_type_hint)response=requests.post(introspection_endpoint,request.encode_x_www_form_urlencoded(),auth=auth,headers={"Content-Type":"application/x-www-form-urlencoded",},)ifresponse.status_code==200:returnTokenIntrospectionSuccessResponse.model_validate_json(response.content)else:returnTokenIntrospectionErrorResponse.model_validate_json(response.content)