Solvedazure sdk for net ClientServerCredential equivalent for simple apiKey authentication?

Is there support for swagger's concept of apiKey auth? The premise is simple; include an apiKey in a named parameter either as a header or a query parameter. Incidentally, this is our team's primary form of providing clients with auth (as opposed to oauth or basic auth).

Usage is very straight forward, adding this form of authentication to a request either requires adding a url parameter (&authenticationParameterName=authenticationParameterValue) or as a header (AuthenticationHeaderName: AuthenticationHeaderValue).

Looking to use it as part of autorest authentication for clients that don't have either oauth or basic auth support; issue called out here (and was redirected to this repo):

Azure/autorest#2431

16 Answers

✔️Accepted Answer

Here is my version of the ServiceClientCredentials for apiKey

class ApiKeyCredentials : ServiceClientCredentials
{
	public override Task ProcessHttpRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken)
	{
		request.Headers.Add("apiKey", "123456");
		return base.ProcessHttpRequestAsync(request, cancellationToken);
	}
}

More Issues: