无法从浏览器调用REST API

时间:2017-03-16 02:06:41

标签: rest restful-authentication

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

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

但是在浏览器中测试相同内容时,我发现404找不到错误。浏览器网址:http://user1.user1Pass@localhost:8080/authenticate

有人可以帮我吗?

2 个答案:

答案 0 :(得分:0)

您正在使用句号而不是冒号。

答案 1 :(得分:0)

网址格式应为http://user1:user1Pass @ localhost:8080 / authenticate

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