introspectTokenWithHttpInfo method

Future<Response> introspectTokenWithHttpInfo(
  1. String token,
  2. String clientId, {
  3. String? clientSecret,
})

Token introspection

Introspects a token to determine its validity and metadata. Per RFC 7662, returns active: false for invalid tokens.

Note: This method returns the HTTP Response.

Parameters:

  • String token (required): The token to introspect

  • String clientId (required): The client identifier

  • String clientSecret: The client secret (for confidential clients)

Implementation

Future<Response> introspectTokenWithHttpInfo(String token, String clientId, { String? clientSecret, }) async {
  // ignore: prefer_const_declarations
  final path = r'/oauth/introspect';

  // ignore: prefer_final_locals
  Object? postBody;

  final queryParams = <QueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  const contentTypes = <String>['application/x-www-form-urlencoded'];

  if (token != null) {
    formParams[r'token'] = parameterToString(token);
  }
  if (clientId != null) {
    formParams[r'client_id'] = parameterToString(clientId);
  }
  if (clientSecret != null) {
    formParams[r'client_secret'] = parameterToString(clientSecret);
  }

  return apiClient.invokeAPI(
    path,
    'POST',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes.first,
  );
}