4 java android android-layout retrofit
错误401 unauthorized
意味着请求由于凭据无效而被拒绝。我正在https
使用改造向 URL 发出请求,并且401 unauthorized
在执行curl https://external:userName@api-staging.xyz.com/user/get
过程中对我来说非常有效(获得预期的输出)。
Retrofit
我的实现没有任何问题,application
因为其他调用工作正常。我无法将这样的 URL 传递给它吗retrofit.setEndpoint
?
Retrofit 可能不支持将用户名和密码放入 URL 中(出于安全原因)。这种身份验证称为基本身份验证,您也可以在 HTTP 标头中传递这些参数。
这是一篇关于如何在 Retrofit 中完成此操作的文章:https ://futurestud.io/blog/android-basic-authentication-with-retrofit/
归档时间: |
|
查看次数: |
9605 次 |
最近记录: |