简体   繁体   English

使用基本HTTP身份验证发布JSON

[英]POST a JSON with Basic HTTP Authentication

as the title says, I need to post a json request with basic http authentication. 如标题所示,我需要发布具有基本http身份验证的json请求。 Unfortunately, I do not have any idea as how it is going to happen. 不幸的是,我不知道它将如何发生。 Are there any tutorial available online that you guys know or at least a sample code so that I can fully understand what to do? 你们是否在线上有任何您知道的教程,或者至少有示例代码,以便我可以完全理解该怎么做?

You can do it easily through the URL: 您可以通过以下网址轻松完成此操作:

http://username:password@www.posttome.com/create

Or through the Header: 或通过标题:

Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l

QWxhZGRpbjpPcGVuU2VzYW1l == base64_encode_somehow("username" + ":" + "password")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM