FLUTTER如何实施摘要式身份验证 [英] FLUTTER How to implement Digest Authentification
问题描述
实现普通的HTTP请求非常容易.但是,要实现摘要式身份验证,我真的不知道如何实现.
to implement a normal HTTP Request is very easy. But to implement a Digest Authentification I do not really know how to implement.
在最佳情况下,您可以将其描述为Flutter,但我不介意它是否是另一种语言.
In the best case you can discribe it for Flutter but I do not mind if it is in another language.
谢谢!
推荐答案
Dart HttpClient
支持摘要.如果您事先知道该领域,请在发出请求之前调用 addCredentials
.如果没有,请实现 authenticate
回调,该回调将通过该方案并将领域返回给您.然后,您应该从回调的实现中调用 addCredentials
.
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.
您仍然可以通过将 package:http
与 HttpClient
一起使用:
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);
这篇关于FLUTTER如何实施摘要式身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!