IBM Worklight版本8.0-访问​​令牌时禁止错误

发布于 2025-01-22 18:14:50 字数 1212 浏览 2 评论 0原文

在访问令牌时收到以下错误:

WLAuthorizationManager.obtainAccessToken()
    .then(
        function (accessToken) {
            console.log(accessToken);
            console.log("Connected to MobileFirst Server")
            WL.Logger.debug("Connected to MobileFirst Server");
        },
        function (error) {
            console.log(error);
            console.log("Failed to connect to MobileFirst Server");
            WL.Logger.debug("Failed to connect to MobileFirst Server");
        }
    );

响应:

errorCode: "403"
errorMsg: "Forbidden"
responseHeaders: {connection: '[Keep-Alive]', content-length: '[199]', content-type: '[text/html; charset=iso-8859-1]', date: '[Thu, 21 Apr 2022 07:29:35 GMT]', keep-alive: '[timeout=120, max=1840]', …}
responseText: "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>403 Forbidden</title>\n</head><body>\n<h1>Forbidden</h1>\n<p>You don't have permission to access this resource.</p>\n</body></html>\n"
status: 403
statusText: "Forbidden"

详细信息: IBM Worklight平台版本:'8.0.0.00-20190910-142437'

将不胜感激。谢谢!

Receiving below error while accessing token:

WLAuthorizationManager.obtainAccessToken()
    .then(
        function (accessToken) {
            console.log(accessToken);
            console.log("Connected to MobileFirst Server")
            WL.Logger.debug("Connected to MobileFirst Server");
        },
        function (error) {
            console.log(error);
            console.log("Failed to connect to MobileFirst Server");
            WL.Logger.debug("Failed to connect to MobileFirst Server");
        }
    );

Response:

errorCode: "403"
errorMsg: "Forbidden"
responseHeaders: {connection: '[Keep-Alive]', content-length: '[199]', content-type: '[text/html; charset=iso-8859-1]', date: '[Thu, 21 Apr 2022 07:29:35 GMT]', keep-alive: '[timeout=120, max=1840]', …}
responseText: "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>403 Forbidden</title>\n</head><body>\n<h1>Forbidden</h1>\n<p>You don't have permission to access this resource.</p>\n</body></html>\n"
status: 403
statusText: "Forbidden"

Details:
IBM Worklight platform version: '8.0.0.00-20190910-142437'

Any help will be appreciated. Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

兔小萌 2025-01-29 18:14:50

您正在得到HTML响应指示403的事实,并且在替换APK时会发生这种情况,指向可能的网络策略或Web服务器阻止PUT请求的

http://<host>:<port>/mfp/api/registration/v1/self/<clientid>

原因是原因是:

  1. MFP服务器不响应 。 html。 MFP服务器仅对JSON响应。在您的情况下看到的响应是自定义HTML。
  2. 当您安装APK新鲜并连接到服务器时,发射的请求为发布http://&lt; host&gt;:&lt; port&gt;/mfp/api/registration/v1/self,而当a 将http://&lt; host&gt;:&lt; port&gt;/mfp/api/registration/v1/v1/v1/self/&lt; clientId&gt;当更新APK时射击(或覆盖)。

另一个远程可能性是,您在服务器中启用了应用程序真实性保护,而在较旧的APK的情况下不起作用。但是,这种情况的机会接近零,因为返回的错误消息可以清楚地表明该问题,并且在新安装的情况下也无法使用。

我建议您验证您的网络策略是否不允许请求请求。

The fact that you are getting an HTML response indicating the 403 and this happens when the apk is replaced, points to a possible network policy or webserver blocking a PUT request to

http://<host>:<port>/mfp/api/registration/v1/self/<clientid>

The reasons why this could be the cause are:

  1. MFP server does not respond with HTML. MFP server responds only with JSON. The response seen in your case is a custom HTML.
  2. When you install an apk fresh and connect to the server, the request that fires is POST http://<host>:<port>/mfp/api/registration/v1/self, while a PUT http://<host>:<port>/mfp/api/registration/v1/self/<clientid> fires when the apk is updated (or overwritten).

The other remote possibility is, you have application authenticity protection enabled in the server that is not working in case of the older apk. However, the chances of this being the case is near zero, as the error message returned gives a clear indication of the issue and it would not have worked in case of a fresh install too.

I would suggest you verify if your network policy does not allow PUT requests.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文