在SAP SuccessFactors中设置OAuth身份验证

发布于 2025-01-22 10:55:25 字数 1341 浏览 2 评论 0原文

为了从成功因素ODATA服务中获取ODATA,我正在尝试通过创建

使用Postman一切正常工作,但是,一旦我检查了先前创建的目标的连接,收到的响应为 401:未经授权

在目的地的配置下方:

在这里您可以看到属性:

以及这里的回应:

我知道这是错误的,但是,出于好奇心,我也创建了一个没有身份验证的目的地。然后直接从代码中开发了三个嵌套的Ajax请求。首先提供断言,其次是用户令牌,第三是利用令牌,获得ODATA的断言。可悲的是,响应始终是 401:未经授权

在最后一个AJAX请求的代码下方,其他两个很好:

 // Validate access token
$.ajax({
    type: 'GET',
    headers: {
        "Authorization": "Bearer " + sAccessToken
    },
    url: '/oauth/validate',
    success: function(data){
        console.log("Success: ", data);
    },
    error: function(e){
        console.log(e);
    }
});

这里请求标头:

”在此处输入图像说明”

In order to get oData from success factors odata service, I'm trying to setting up a connection between SuccessFactors and SAP BTP by creating a destination as reported in this official guide.

Using postman everything works fine but, once I check the connection of destination previously created, the response received is 401: Unauthorized.

Below the configuration of destination:
enter image description here

Here you can see the properties:
enter image description here

And here the response:
enter image description here

I know that is wrong but, for the sake of curiosity, I've also created a different destination with no authentication. Then directly from code I've developed three nested ajax requests. First provides the assertion, second the user token, third is the one which, leveraging the token, get the odata. Sadly response is always 401: Unauthorized.

Below the code of last ajax request, the other two are good:

 // Validate access token
$.ajax({
    type: 'GET',
    headers: {
        "Authorization": "Bearer " + sAccessToken
    },
    url: '/oauth/validate',
    success: function(data){
        console.log("Success: ", data);
    },
    error: function(e){
        console.log(e);
    }
});

Here the request header:

enter image description here

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

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

发布评论

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

评论(1

浅笑依然 2025-01-29 10:55:25

因此,不确定您的流程如何。通常,您将通过具有xs-app.json的SAP Axpoututer连接到BTP,该Appouter 定义了要使用的路由和目的地。然后,Applouter将向内部BTP JWT与SAML主张成功交换了成功量。如果您想通过BTP目标服务向您自己请求身份验证Infos,则必须通过HTTP Header Field X-user-toke将有效 btp JWT发送到目标服务,作为响应,您将获得成功的Farefactors Oauth Bearer令牌。

请参阅此处

希望它有助于

问候
MATHIAS

So not sure how your flow really is. Normaly you would connect to BTP via a SAP Approuter which has a xs-app.json which defines the routes and destinations to use. Then the Approuter would Exchange the internal BTP JWT with a SAML Assertion for Successfactors. If you want to request the authentication infos for yourself via the BTP Destination Service, you have to send a valid BTP JWT to the destination service via the HTTP Header field X-user-token and as a response you would get back a Successfactors OAuth bearer token.

See here

hope it helps

Regards
Mathias

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