问题
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!
回答1:
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);
来源:https://stackoverflow.com/questions/56022844/flutter-how-to-implement-digest-authentification