微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法放心获取带有localhost url的令牌

如何解决无法放心获取带有localhost url的令牌

我是使用放心测试的新手。在邮递员中它工作正常并且可以返回令牌。但是,当我使用放心获取令牌时,它在状态代码中返回 404,在正文响应中返回“错误”:“未授权”。 这是我的代码

 RequestSpecification request = RestAssured.given();
 Response res = request
            //.contentType("application/json")
            .queryParam("username","uname")
            .queryParam("password","password")
            .queryParam("cliend_id","android")
            .queryParam("grant_type","password")
            .queryParam("scope","trust")
            .post("http://localhost:8080/com.abcde.webservices/oauth/token");
 System.out.println("Response : "+res.asstring());
 System.out.println(res.getStatusCode());

我已经尝试使用

 RestAssured.baseURI = "http://localhost:8080/com.abcde.webservices";
 .....
 .post("/oauth/token");

但是还是拿不到token

解决方法

我刚刚意识到我错过了在 clint_id 中输入它的情况。我输入cliend_id,它应该是client_id。更改后一切正常。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。