Sharepoint REST api - 领域不是当前服务命名空间错误 50169 的配置领域
Sharepoint REST api - Realm is not a configured realm of the current service namespace error 50169
我在尝试从 Sharepoint REST api 获取授权令牌时遇到此错误。我的 SP 是基于云的,我正在使用 Postman 来测试请求,就像之前的尝试一样 运行 进入死胡同,当使用 Msoft 来回进行故障排除时,无处可去。无论如何,我有以下错误和我想知道是否有人可以帮助我弄清楚它是什么或如何解决这个问题。
error_description: "AADSTS50169: The realm 'realm' is not a configured realm of the current service namespace"
error_codes : 50169
谢谢!
编辑:我完成并重新开始,这个 tut 似乎有效我想我可能错过了一步(我的猜测是我在创建时没有使用 xml 正确配置应用程序权限应用)
通过Postman对SharePoint online进行授权并使用RESTAPI,这里有一个解决方案供大家参考:
第一:获取安全令牌
通过 Http Post 方法访问 [https://login.microsoftonline.com/extSTS.srf]。 http请求内容如下
<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]</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>[endpoint]</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>
Postman中的演示截图:
并且响应内容会包含一个安全令牌,如下所示,我们可以使用这个安全令牌来获取SharePoint的访问令牌。
第二:获取访问令牌
在这里,我将向您展示如何使用安全令牌和 SharePoint Rest 获取 SharePoint online 的访问令牌API。
通过 http Post 方法访问 [https://yourdomain.sharepoint.com/_forms/default.aspx?wa=wsignin1.0]。请求的内容是我们在上面获得的安全令牌,如下所示。
响应如下:
我们可以看到response header中有两个cookie,rtFa和FedAuth,这两个cookie需要在后续的请求中添加到请求中。
第三:获取请求摘要
通过 http Post 方法使用我们在上面获得的两个 cookie 访问 [https://yourdomain.sharepoint.com/_api/contextinfo]。
响应如下:
这就是我们想要的最终代币!
然后我们就可以使用SharePoint的RESTAPI了,我们只需要添加这个token和前面两个cookie,如下图。
我在尝试从 Sharepoint REST api 获取授权令牌时遇到此错误。我的 SP 是基于云的,我正在使用 Postman 来测试请求,就像之前的尝试一样 运行 进入死胡同,当使用 Msoft 来回进行故障排除时,无处可去。无论如何,我有以下错误和我想知道是否有人可以帮助我弄清楚它是什么或如何解决这个问题。
error_description: "AADSTS50169: The realm 'realm' is not a configured realm of the current service namespace"
error_codes : 50169
谢谢!
编辑:我完成并重新开始,这个 tut 似乎有效我想我可能错过了一步(我的猜测是我在创建时没有使用 xml 正确配置应用程序权限应用)
通过Postman对SharePoint online进行授权并使用RESTAPI,这里有一个解决方案供大家参考:
第一:获取安全令牌
通过 Http Post 方法访问 [https://login.microsoftonline.com/extSTS.srf]。 http请求内容如下
<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]</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>[endpoint]</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>
Postman中的演示截图:
并且响应内容会包含一个安全令牌,如下所示,我们可以使用这个安全令牌来获取SharePoint的访问令牌。
第二:获取访问令牌
在这里,我将向您展示如何使用安全令牌和 SharePoint Rest 获取 SharePoint online 的访问令牌API。
通过 http Post 方法访问 [https://yourdomain.sharepoint.com/_forms/default.aspx?wa=wsignin1.0]。请求的内容是我们在上面获得的安全令牌,如下所示。
响应如下:
我们可以看到response header中有两个cookie,rtFa和FedAuth,这两个cookie需要在后续的请求中添加到请求中。
第三:获取请求摘要
通过 http Post 方法使用我们在上面获得的两个 cookie 访问 [https://yourdomain.sharepoint.com/_api/contextinfo]。
响应如下:
这就是我们想要的最终代币!
然后我们就可以使用SharePoint的RESTAPI了,我们只需要添加这个token和前面两个cookie,如下图。