2024 Nov 23 3:40 PM - edited 2024 Nov 23 3:43 PM
I have an OAuth 2.0 client set up in transaction OA2C_CONFIG. The grant type is Resource Owner Password Credentials. I am authenticating against this client from my ABAP code before calling the associated external API. But after a while, the token expires, and I would to request the user to reenter their user and password and set a new token.
From the UI, I would click the "Request Token" button in transaction OA2C_CONFIG (and enter user and password) to achieve this effect.
How do I do this in ABAP code?
I though I might do it like this
CREATE OBJECT lo_oa2c_api
EXPORTING
i_client_uuid = lv_client_uuid.
lo_oa2c_client->execute_ropc_flow(
EXPORTING
i_username = lv_username
i_password = lv password
).
but SAP is checking via the callstack that the call is actually coming from the transaction OA2C_CONFIG and rejects the call if it was sent by another program. So I am clearly doing it wrong.
Can anyone advise what the right way would be?
I'm on S/4 2023 FP0.
Request clarification before answering.
-
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 14 | |
| 8 | |
| 6 | |
| 6 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.