首页 > 解决方案 > 在 api 调用之前放心的 Microsoft 登录

问题描述

我有安全的 API,它在调用方法之前使用 Microsoft 登录。当我在未登录的情况下尝试放心

RestAssured.baseURI = url;
    RequestSpecification httpRequest = RestAssured.given();
    Response response = httpRequest.get();

    // Retrieve the body of the Response
    ResponseBody body = response.getBody();

    // By using the ResponseBody.asString() method, we can convert the  body
    // into the string representation.
    System.out.println("Response Body is: " + body.asString());

我得到以下回应

响应正文是:

<title>Sign in to your account</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, 
maximum-scale=2.0, user-scalable=yes">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="-1">
<meta name="PageID" content="ConvergedSignIn" />
<meta name="SiteID" content="" />
<meta name="ReqLC" content="1033" />
<meta name="LocLC" content="en-US" />
<noscript>

我如何发送 microsoft 登录详细信息,然后将 session 用于其他 api 调用

标签: restapioffice365apirest-assured

解决方案


推荐阅读