【问题标题】:Sitecore restful API authentication not returning tokenSitecore RESTful API 身份验证不返回令牌
【发布时间】:2020-01-24 07:20:47
【问题描述】:

在 Sitecore 中,我有一个项目,我想通过 API 访问该项目。 所以我找到了这个文件: https://doc.sitecore.com/developers/82/sitecore-experience-platform/en/the-restful-api-for-the-itemservice.html

我正在尝试使用“https:///sitecore/api/ssc/auth/login”通过 Postman 对其进行身份验证 响应状态为 200 OK.Response image Login Process

但是什么都没有回来,没有令牌,没有错误。 Postman response on login no token

【问题讨论】:

    标签: api sitecore sitecore8


    【解决方案1】:

    你应该得到一个 Cookie。 在请求头中设置“Content-Type: application/json”。 并使用类似的东西

    {
        "domain": "sitecore",
        "username": "admin",
        "password": "b"
    }
    

    如果您有自签名证书,请在 Postman 顶部菜单的设置/常规中关闭 SSL certification verification

    提示https://sitecore-community.github.io/docs/documentation/Sitecore%20Services%20Layer/Play%20with%20Item%20Services/,您可以下载具有正确设置的 Postman 文件进行登录。

    【讨论】:

      【解决方案2】:

      auth/login API 只需要 Https(不是 http)。 如果您在本地运行您的网站,您可以轻松创建自签名证书,然后您可以使用 HTTPS 绑定您的网站。

      只需按照几个简单的步骤, https://www.youtube.com/watch?v=RkI3BJVxSgo

      然后通过在 Postman 的请求正文中传递 Sitecore 用户凭据来调用 https://[hostname]/sitecore/api/ssc/auth/login API。 如果我们从同一台机器调用这些 API,Sitecore API 将返回正确的数据和 200 响应。

      然后你可以调用 https://[hostname]/sitecore/api/ssc/auth/logout 来清除 auth cookie。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-09-22
        • 2018-04-23
        • 2014-10-09
        • 1970-01-01
        • 2017-07-20
        • 1970-01-01
        相关资源
        最近更新 更多