With previous versions of Saloon, you could only have one authenticator per connector/request. This meant that if an API utilized multiple ways of authentication like a certificate and an Authorization header you would have to write it manually. You can now use the MultiAuthenticator to use multiple authenticators at once.
protected function defaultAuth(): Authenticator
{
return new MultiAuthenticator(
new TokenAuthenticator('example'),
new HeaderAuthenticator('api-key', 'X-API-Key'),
);
}
This is a backwards-compatible change and it's entirely opt-in.
Update - some feedback is suggesting just introduce the new MultiAuthenticator authenticator which can be used when multiple authenticators want to be used at the same time.
With previous versions of Saloon, you could only have one authenticator per connector/request. This meant that if an API utilized multiple ways of authentication like a certificate and an
Authorization
header you would have to write it manually. You can now use theMultiAuthenticator
to use multiple authenticators at once.This is a backwards-compatible change and it's entirely opt-in.