public String getAuthToken(String userId, String password) {
String authToken = null;
try {
authToken =
Unirest.post(MessageFormat.format("http://{0}:{1}/login", host, port))
.header("accept", "application/json")
.header("Content-Type", "application/json")
.body(new JSONObject() //Using this because the field functions couldn't get translated to an acceptable json
.put("userId", userId)
.put("password", password)
.toString())
.asJson()
.getBody().getObject().getString("token");
} catch (UnirestException e) {
e.printStackTrace();
}
return authToken;
}
Authorization.java 文件源码
java
阅读 25
收藏 0
点赞 0
评论 0
项目:SKIL_Examples
作者:
评论列表
文章目录