我们正在尝试从sharepoint online获取访问令牌。
使用这个postman调用窗体/default.aspx?wa=wsignin1.0 1.0。
但是在return.only中却没有得到fedauth和rtfa cookie,得到了conext响应cookie。按照这个链接给邮递员打电话。有谁面临同样的问题吗?
发布于 2022-03-11 03:30:38
首先,您需要获得一个二进制安全令牌,您需要使用Microsoft安全令牌服务,请输入以下URL:
https://login.microsoftonline.com/extSTS.srf
然后,需要添加以下XML信封作为消息体,将用户名、密码和您的域替换为您的data.Please集合内容-类型到应用程序/x 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>
在返回请求中,您将得到"BinarySecurityToken",请复制它并将其添加到"body".you可以向以下URL发送一个POST请求,最后您将得到fedauth和rtfa。
https://[YourDomain].sharepoint.com/_forms/default.aspx?wa=wsignin1.0
下面是一些你可以参考的截图:
https://stackoverflow.com/questions/71423224
复制相似问题