cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Cloud SDK - AuthInfo / Subdomain interfaces

former_member743968
Participant
0 Kudos

https://help.sap.com/doc/88b0d45562c04571a8d117bc8b6b3b7a/1.0/en-US/modules/_sap_cloud_sdk_core.html

Hello,

Is there a way to retrieve the AuthInfo and Subdomain from a incomming request using the cloud sdk? I do not see an available interface to pull either on the documentation above.

For reference, when xsuaa is active on a CAP project - All Incomming requests contain the 'authInfo' object with useful methods such as: getZoneId(), getSubdomain().

I'd like to be able to also pull this values through the SDK.

context.req.authInfo.getZoneId()
context.req.authInfo.getSubdomain()
gregorw
Active Contributor
0 Kudos

Can you describe why your don't have XSUAA in your usecase?

former_member743968
Participant
0 Kudos

gregorw I am using xsuaa but did not see a method to retrieve subdomain from the sdk.

My use case is attempting to add a paramerter to the cds-route-handling library the same way it retrieves a jwt token from the cloud sdk. Right now, the only way I know to retreieve AuthInfo / subdomain is to check if the request object contains authInfo.

Accepted Solutions (0)

Answers (2)

Answers (2)

gregorw
Active Contributor

What's about using the fields:

    "subaccountid": "Subaccount GUID", 
    "zdn": "domain",

from the JWT?

0 Kudos

Hey akloske, I think Gregor's suggestion currently is the best option. You can use the decodeJwt function and then read the sub and zid values if you need those. If this does not meet your requirements, I suggest to create a feature request here.

0 Kudos

BTW, I realized that you are looking at a very old version of the API docs. You can find the latest API reference here. I highly recommend to upgrade to version 2.