cancel
Showing results for 
Search instead for 
Did you mean: 

How to get token using destination in CAPM based service?

karanbahl
Active Participant
0 Kudos

Hi All,

I want to instantiate a workflow instance from my CAPM based service for which I need to pass the authorization header token. I am able to pass it by passing the headers as below; however I want to replace this method by a dynamic one; for example a destination so that I do not to pass the authorization as below. Any suggestions; how can we do it?

jhodel18 - any suggestions?

Regards,

Karan

  var options = {
  'method': 'GET',
  'url': 'https://scp/oauth/token?grant_type=client_credentials',
 'headers': {
               'Accept': 'application/json',
               'Content-Type': 'application/json',
               'Authorization': 'Basic ************************'
                        }
              };
former_member729305
Participant
0 Kudos

Dear karanbahl

can you give some guidance how to solve that issue as I am currently having the same issue? see issue description here:

https://github.com/SAP/cloud-sdk-js/issues/1051

I would be very grateful!

Best Regards

Max

Accepted Solutions (1)

Accepted Solutions (1)

gregorw
Active Contributor

Please check the recent discussions on the workflow service with CAP topic.

karanbahl
Active Participant
0 Kudos

Thanks Gregor; was able to use some of the findings to resolve my issue.

Answers (1)

Answers (1)

jhodel18
Active Contributor

Hi Karan,

I haven't really tried SCP Workflow yet, but based on what you are doing -- you are manually getting the JWT token. If your CAP-based service is authenticated by the same UAA service then that means you already have the token within the CAP framework.

I have written a blog post about how the User Authentication works in CAP -- https://blogs.sap.com/2020/07/20/cap-demystify-user-authentication/

The security context is the decoded JWT Token. If you can get that from within CAP then it should be the answer to the dynamic way you are looking for.

I hope it helps!

karanbahl
Active Participant
0 Kudos

Thanks Jhodel; was able to utilize a few steps from your blog.