FLUTTER How to implement Digest Authentification

526

The Dart HttpClient supports digest. If you know the realm in advance, call addCredentials before making the request. If not, implement the authenticate callback which will pass the scheme and realm back to you. You should then call addCredentials from your implementation of the callback.

You can still use package:http with an HttpClient, by passing it in:

  HttpClient authenticatingClient = HttpClient();
  authenticatingClient.addCredentials(url, realm, credentials);
  http.Client client = http.IOClient(authenticatingClient);
Share:
526
Oliver
Author by

Oliver

Updated on December 11, 2022

Comments

  • Oliver
    Oliver over 1 year

    to implement a normal HTTP Request is very easy. But to implement a Digest Authentification I do not really know how to implement.

    In the best case you can discribe it for Flutter but I do not mind if it is in another language.

    Thank You!