I have a Django application which connects to Salesforce using some user informed credentials and an user informed Salesforce record ID. But I don't want my users accessing an external system anymore, so I need to make Salesforce connect to this external system and give this record ID and credentials instead. But I can't modify the existing system, so I need to put user's username, password and token as POST parameters when making the callout.
I couldn't find any UserInfo.getPassword()
or similar functions to get running user's credentials to add in the body for the callout. How is that possible?
EDIT: By using Named Credentials, I can access {!$Credentials.UserName}
and {!$Credentials.Password}
and insert them in the POST body, but I couldn't find any way to get the API Token. Is there any way? My external system needs these 3 credentials to be able to do his thing. I know it would be best to have a different endpoint which does not require this information, but right now I don't have the option to create another service.