sách gpt4 ăn đã đi

Xác thực HTTP của Android

In lại 作者:搜寻专家 更新时间:2023-11-01 09:12:28 27 4
mua khóa gpt4 giày nike

如何在 Android 中通过 HTTP 进行身份验证?

câu trả lời hay nhất

我非常难以在 Android 中通过 HTTP 进行身份验证,因为在浏览器(Web 和 Android native )中它工作完美并要求提供凭据,但这个场景不在代码中。所以这是我使用的代码。

URL url = new URL("YOUR URL HERE");


Authenticator.setDefault(new Authenticator(){
@Ghi đè
protected PasswordAuthentication getPasswordAuthentication() {
System.err.println("Feeding username and password for " + getRequestingScheme());
return (new PasswordAuthentication("username", "password".toCharArray()));
}});
InputStream stream = url.openStream();

关于安卓 HTTP 认证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7288526/

27 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress