openapi-generator-dart
openapi-generator-dart copied to clipboard
How to set bearer token to client
Im trying to setup token to api_client please help i cant find
_authentications['isOAuth'] = new OAuth("sdfd");
it will throw this
throw ArgumentError('Authentication undefined: $authName');
/// Update query and header parameters based on authentication settings.
/// @param authNames The authentications to apply
void _updateParamsForAuth(
List<String> authNames,
List<QueryParam> queryParams,
Map<String, String> headerParams,
) {
for (final authName in authNames) {
final auth = _authentications[authName];
if (auth == null) {
throw ArgumentError('Authentication undefined: $authName');
}
auth.applyToParams(queryParams, headerParams);
}
}
Your spec needs to have the security scheme defined first.
Then configure it using new Api().setOAuthToken();