Hello Rajesh,
While i understand the concern that you really want to limit the number of API calls and which sounds reasonable as well, AFAIK oauth token calls are not metered by any API provider but yes they are a overhead if you can get away with a refresh token.
SAP PO doesn’t have any storage mechanisms . It’s a shame but thats how it has always been.
Your options here are limited while i have never explored use of refresh token specifically in PO rest adapter this would have been a cakewalk in SAP CPI.
There are java based tables which you can create and modify in sap po but i doubt system admin will allow you access to modify java stack database. It’s highly critical.
In the end if it is really not a deal breaker i would suggest that you get a fresh token every time or let the channel manage it.
Again, I am not an expert here that’s why didnt pitch in earlier but there would be some better answers than mine that would be able to help you.
Try tagging michael or eng swee.
Regards
Vinay
Regards
Vinay Mittal
Hi!
It doesn't seem to be the best way, but you could save your token to PI server file system in the form of text/xml file and read it using UDF in your message mapping.
Regards, Evgeniy.
Hi Rajesh,
try using Value Mapping to save the tokens.
Do you need both access token & refresh token for your scenario? If you are using Rest Pooling then you can have a fresh access token every 20-25 min.
Thanks
Ankit
Hi,
Refresh token sadly not possible. I find Evgeniy Kolmakov solution suitable enough.
Sad, but not many optimized solutions available here.
Regards,
Vikas
Hi Rajesh,
This is a good question. I actually thought that the REST Receiver adapter caches the token by itself (there is a checkbox for it). Are you not using this adapter or does it not fulfill your requirement?
I had a similar requirement but for a SOAP API where I had to pass the token in the SOAP Header. I wrote a UDF which fetched the token in the first request and stores it in the value mapping cache together with a timestamp. In the subsequent requests it loads and compares the timestamp with the current time and only fetches a new token in case the cached token has expired (validity in minutes can be configured as module parameter). I didn't deem the VM store a security risk since access to the VM cache monitor is restricted to PO admins and the scenario does not contain confidential data. But maybe one could also consider encrypting the stored token?
Anyway, you are looking for another approach. So maybe this helps in case you don't know it yet: I recently came across a very interesting article about this topic that seems to use an internal PO class called MessageIDMapper which was so far unknown to me. The solution makes use of these methods to store the token to PO internal tables. Maybe that helps.
Philippe
Add comment