I'm trying to make a callout to /services/data/v45.0/wave/datasets in a lightning web component. I can successfully make the callout for the running user in apex using UserInfo.getSessionId() but there doesn't seem to be any equivalent available for use in the javascript controller of a lwc. The data cannot be wired from the apex class, the callout errors out with invalid session id because UserInfo.getSessionId() isn't meant to work in methods decorated with @AuraEnabled.

I'd like to be able to distribute this component to different orgs freely. Is there a way to effectively retrieve this data client side in a way that is org / user agnostic? I've read about a workaround where user session id can be retrieved from a visualforce page, I'd rather not do this if possible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.