setAuthenticate method
Sets the function to be called when a site is requesting authentication.
Pass through setter of HttpClient.authenticate. This callback called
when server returns Unauthorized (401). addCredentials can be called
in this callback method to authorize client.
Returns false when authorization cannot be provided.
Throws StateError when using WebDavStdClient.authenticated.
Example:
client.setAuthenticate((url, scheme, realm) {
client.addCredentials(...);
return Future.value(true);
});
Implementation
@override
void setAuthenticate(
Future<bool> Function(Uri url, String scheme, String? realm)? f,
) {
_checkLegacyAuthentication();
client.authenticate = f;
}