gpt4 book ai didi

android - 如何在android中进行HTTP身份验证?

转载 作者:IT老高 更新时间:2023-10-28 13:13:17 35 4
gpt4 key购买 nike

我正在检查类 org.apache.http.auth。如果有人有更多的引用或例子吗?

最佳答案

对我来说,它有效,

final String basicAuth = "Basic " + Base64.encodeToString("user:password".getBytes(), Base64.NO_WRAP);

Apache HttpCLient:

request.setHeader("Authorization", basicAuth);

HttpUrlConnection:

connection.setRequestProperty ("Authorization", basicAuth);

关于android - 如何在android中进行HTTP身份验证?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1968416/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com