applyToParams method
Apply authentication settings to header and query params.
Implementation
@override
Future<void> applyToParams(
List<QueryParam> queryParams, Map<String, String> headerParams) async {
if (accessToken == null && tokenExpiration == null) {
if (clientId != null && clientSecret != null) {
accessToken = await fetchToken();
} else {
throw ApiException(0, "clientId or clientSecret not defined");
}
}
if (accessToken == null) {
throw ApiException(0, "accessToken is null");
}
headerParams["Authorization"] = "Bearer ${accessToken!}";
}