diff --git a/lib/src/auth/api_key_auth.dart b/lib/src/auth/api_key_auth.dart index 03a1a04..1f08e43 100644 --- a/lib/src/auth/api_key_auth.dart +++ b/lib/src/auth/api_key_auth.dart @@ -2,7 +2,6 @@ // AUTO-GENERATED FILE, DO NOT MODIFY! // - import 'package:dio/dio.dart'; import 'package:tuuli_api/src/auth/auth.dart'; @@ -11,20 +10,12 @@ class ApiKeyAuthInterceptor extends AuthInterceptor { @override void onRequest(RequestOptions options, RequestInterceptorHandler handler) { - final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'apiKey'); - for (final info in authInfo) { - final authName = info['name'] as String; - final authKeyName = info['keyName'] as String; - final authWhere = info['where'] as String; - final apiKey = apiKeys[authName]; - if (apiKey != null) { - if (authWhere == 'query') { - options.queryParameters[authKeyName] = apiKey; - } else { - options.headers[authKeyName] = apiKey; - } - } + for (final entry in apiKeys.entries) { + final authName = entry.key; + final apiKey = entry.value; + options.headers[authName] = apiKey; + + super.onRequest(options, handler); } - super.onRequest(options, handler); } }