Fedauth,在响应 Sharepoint 在线身份验证中未找到 rtfa cookie

Fedauth, rtfa cookies not found in response sharepoint online auth

我们正在尝试从在线共享点获取访问令牌。

使用这个邮递员 api 调用 https://mydomain.sharepoint.com/_forms/default.aspx?wa=wsignin1.0

但在 return.only 获取 conext 响应 cookie 时未获取 fedauth 和 rtfa cookie。 按照此 Link 进行邮递员调用。 有人面临同样的问题吗?

首先,您需要获取一个二进制安全令牌,您需要使用Microsoft Security Token Service,请输入以下内容URL:

https://login.microsoftonline.com/extSTS.srf

然后,需要添加以下 XML 信封作为消息 body,将 [用户名]、[密码] 和 [您的域] 替换为您的 data.Please 设置 Content-Type 到请求 Header 中的 application/x-www-form-urlencoded。

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
      xmlns:a="http://www.w3.org/2005/08/addressing"
      xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
  <s:Header>
    <a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</a:Action>
    <a:ReplyTo>
      <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
    </a:ReplyTo>
    <a:To s:mustUnderstand="1">https://login.microsoftonline.com/extSTS.srf</a:To>
    <o:Security s:mustUnderstand="1"
       xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <o:UsernameToken>
        <o:Username>[username]@[YourDomain].onmicrosoft.com</o:Username>
        <o:Password>[Password]</o:Password>
      </o:UsernameToken>
    </o:Security>
  </s:Header>
  <s:Body>
    <t:RequestSecurityToken xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust">
      <wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
        <a:EndpointReference>
          <a:Address>https://[yourdomain].sharepoint.com/</a:Address>
        </a:EndpointReference>
      </wsp:AppliesTo>
      <t:KeyType>http://schemas.xmlsoap.org/ws/2005/05/identity/NoProofKey</t:KeyType>
      <t:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</t:RequestType>
      <t:TokenType>urn:oasis:names:tc:SAML:1.0:assertion</t:TokenType>
    </t:RequestSecurityToken>
  </s:Body>
</s:Envelope>

在return请求中,您会得到“BinarySecurityToken”,请将其复制并添加到“body”中。您可以向以下发送POST请求URL ,最后你会得到 fedauth 和 rtfa cookies。

https://[YourDomain].sharepoint.com/_forms/default.aspx?wa=wsignin1.0

以下截图供您参考: