oauthTokenWithHttpInfo method
Exchange authorization code or refresh token for an access token (+ id_token if openid scope).
Note: This method returns the HTTP Response.
Parameters:
Implementation
Future<Response> oauthTokenWithHttpInfo(String grantType, { String? code, String? codeVerifier, String? redirectUri, String? refreshToken, String? clientId, String? clientSecret, }) async {
// ignore: prefer_const_declarations
final path = r'/oauth2/token';
// 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 (grantType != null) {
formParams[r'grant_type'] = parameterToString(grantType);
}
if (code != null) {
formParams[r'code'] = parameterToString(code);
}
if (codeVerifier != null) {
formParams[r'code_verifier'] = parameterToString(codeVerifier);
}
if (redirectUri != null) {
formParams[r'redirect_uri'] = parameterToString(redirectUri);
}
if (refreshToken != null) {
formParams[r'refresh_token'] = parameterToString(refreshToken);
}
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,
);
}