TokenRequestDetails constructor

TokenRequestDetails(
  1. Config config,
  2. String? code
)

Implementation

TokenRequestDetails(Config config, String? code) {
  url = config.tokenUrl;
  params = {
    'client_id': config.clientId,
    'code': code,
    'redirect_uri': config.redirectUri,
    'grant_type': 'authorization_code'
  };

  if (config.resource != null) {
    params!.putIfAbsent('resource', () => config.resource);
  }

  if (config.clientSecret != null) {
    params!.putIfAbsent('client_secret', () => config.clientSecret);
  }

  headers = {
    'Accept': 'application/json',
    'Content-Type': config.contentType
  };
}