【问题标题】:unable to call REST API from browser无法从浏览器调用 REST API
【发布时间】:2017-08-07 00:51:54
【问题描述】:

我的带有基本身份验证的 REST API 使用 Rest 客户端 (Google Chrome extn) 可以正常工作。 下面的 Curl 命令也可以正常工作:

curl --header "Accept:application/json" -i --user user1:user1Pass http://localhost:8080/authenticate

但是在浏览器中进行相同测试时,我得到了 404 not found 错误。浏览器网址:http://user1.user1Pass@localhost:8080/authenticate

谁能帮我解决这个问题?

【问题讨论】:

    标签: rest restful-authentication


    【解决方案1】:

    您使用的是句号而不是冒号。

    【讨论】:

    • 出现拼写错误。我已经使用如下,但仍然无法正常工作:user1:user1Pass@localhost:8080/authenticate
    【解决方案2】:

    url的格式应该是http://user1:user1Pass@localhost:8080/authenticate

    重点是你需要用冒号分隔用户名和密码。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-10-24
    • 2023-03-29
    • 1970-01-01
    • 1970-01-01
    • 2015-02-24
    • 1970-01-01
    • 1970-01-01
    • 2013-01-14
    相关资源
    最近更新 更多