cancel
Showing results for 
Search instead for 
Did you mean: 

Authorization header missing on request.

07-19-2022 9:13 AM
krishnan-jr Participant
2047 views 0 comments
0 Likes
SAP Managed Tags
Subscribe

Hi experts,

We are in the process of transporting our application from TDD account to OEM account.

In OEM account we set up a BAS instance to do deployment and testing (all default-env files in place).

While trying to run a functionality we are getting 401 Unauthorized due to missing authorization header in request. this functionality is still working fine on our TDD BAS instance.

Below are our configuration and code related to the issue.

In xs-app.json file of our app router folder we have multiple destination and one of which is srv_process which is a nodejs application.

{
            "source": "^/process/(.*)$",
            "authenticationType": "xsuaa",
            "scope": "$XSAPPNAME.User",
            "destination": "srv_process"
 },<br>
On the server.js file of srv_process we have passport module defined.
passport.use('JWT', new xssec.JWTStrategy(services.uaa));
app.use(passport.initialize());
app.use(passport.authenticate('JWT', {
    session: false
}));<br>
The api call to srv_process is triggered by an custom button from fiori elements app.
        sync: function (oContext, aSelectedContexts) {
            jQuery.ajax({
                url: "/process/import-bank-master",
                type: "GET",
                success: function (response) {
                    MessageToast.show(response.msg);
                },
                error: function (response) {
                    MessageToast.show(response.msg);
                }
            })

        }<br>
In the normal flow the authentication parameter should be automatically attached in the header of ajax request from fiori app but in this case its no working.

Any suggestion to solve the issue is appreciated.Best regards Anoop krishnan.

0 Likes

Accepted Solutions (0)

Answers (0)