TokenRequestDetails constructor

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

Implementation

TokenRequestDetails(Config config, String code)
    : url = config.tokenUrl,
      params = {
        'client_id': config.clientId,
        'grant_type': 'authorization_code',
        'scope': config.scope,
        'code': code,
        'redirect_uri': config.redirectUri,
      },
      headers = {
        'Accept': 'application/json',
        'Content-Type': Config.contentType,
        if (config.origin != null) 'Origin': config.origin!,
      } {
  if (config.resource != null) {
    params.putIfAbsent('resource', () => config.resource!);
  }

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

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