2019 Feb 14 7:31 AM
Hello,
I am trying to configure an OAuth 2.0 Client using this guide:
Problem is there is no support for "Client Credentials" Grant Type. In interface if_oa2c_specifics~get_supported_grant_types there are only these four:
Is there any way to use Client Credentials grant type?
2019 Feb 14 12:06 PM
For now I went with custom solution using just simply:
2019 Feb 14 12:06 PM
For now I went with custom solution using just simply:
2019 Sep 12 5:44 PM
Hi Tomas,
In my case grant_type=password. I used below code and it worked to get token but I don’t want to pass clear text in password. i created RFC destination and kept passwod in destination and used lo_http_client=>create_by_destination but still without below code it is not working. Please any suggestions.
************************************************************
CONCATENATE 'grant_type=password' '&'
'username='
lv_username '&'
'password=' lv_password
INTO lv_cdata.
lv_content_length_value = strlen( lv_cdata ).
CALL METHOD lo_http_client->request->if_http_entity~set_cdata
EXPORTING
data = lv_cdata
length = lv_content_length_value
offset = 0.
**************************************************************
Thanks,
Praveen
2019 Sep 13 7:32 AM
Hi prvn.kumar,
grant_type should be set as "form field". Like this:
lo_http->request->set_form_field( EXPORTING name = 'grant_type'
value = 'client_credentials' ).
2019 Sep 13 9:02 PM
Hi Tomas,
Thanks
for the quick reply. Unfortunately it did not worked. i still ending up with
moving password external like in my first ask. i am trying to avoid moving
password externally and instead i want to use password from the RFC destination
where I save usename and password.
Thanks,
Praveen
2019 May 20 1:03 PM
Thanks Tomas, I too had to do the same.
Not sure why SAP support client credential for cloud solution and not for ERP on premise.
Did you build anything to store the token too like encrypt and decryption?
2019 May 20 3:05 PM
No, I am using token directly in call #2 (to main API endpoint).
But there are no borders in what can be done with retrieved token if you end up in custom ABAP solution 🙂 You can for example store it in table with a timestamp and then just call API & check if token is still valid or retrieve new one.
2020 Jan 24 8:36 PM
Hello Tomas,
Im curious to see how did you end up implementing your credentials_grant solution. I am having a similar issue and I would like to know your experience on this in detail, if thats ok with you 🙂
Did you end up redefining/creating your own cl_oauth2_s_token_endpoint? I read that you are not saving this anywhere so are you getting a new one with every request? Are you using the same logic on cl_oauth2_s_prot_auth_code or did you go with your own?
Is there any chance you could share parts of your code to have a more clear understanding?
Thank you so much in advance.
Kr,
Vicente
2020 Jan 27 7:20 AM
2020 Jan 27 5:23 PM
Hi Tomas, thanks for your reply!
Yes I am thinking this through exactly the opposite way, where SAP is the oAuth server and I am trying to connect from a third party to SAP. I might need to get my hands on an SAP cloud solution to see how they support that flow there 🙂
Thank you!
Kr,
2020 Jan 28 7:41 AM
Hello, I do not have experience with this opposite way, so I can not help. Sorry
By the way if you are in discussion here, better use "Comment" and not "Answer". "Answer" is only answer to the original question, which none of your posts here are...
2020 Jan 30 11:52 PM
You are right, I did not mean to do that. I'll be more careful next time.
Kr.