$currentUser is (empty) in RESTs microflows

Hi! I’m using the OIDC marketplace modul to authenticate users through SSO. I successfully managed that with keycloak integration. OIDC module created an user with “user” role. All okay. I would like to create Published REST service, which will call another server’s endpoints in order to retrieve data. For that, I should use OIDC’s GET/POST/… microflows in order to get authenticated. For that I have to provide a “Token”, which is generated when I logged in. I can reach that through $currentUser, but this value is empty in these microflows.
1 answers

Published REST services run in the system context, so this means there isn’t a $currentUser for you to use.

In this case, you will have to do a Retrieve action against the database directly, probably sorting by createdDate so you get the most recent, and using that.

Hope this helps.