I am trying to do an API within my Salesforce to get the describe metadata, from winter 19 release notes and this idea that was marked as already delivered (Allow Apex to call Salesforce REST and SOAP API's without a Remote Site Setting), I understood that I dont required to do the API to retrieve the session ID and I can use System.UserInfo.getSessionId(), also I will not need to set up the remote site.
However, this still not the case I still have to set up remote site setting and if I try using System.UserInfo.getSessionId(), I get the error:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="http://soap.sforce.com/2006/04/metadata">
<soapenv:Body>
<soapenv:Fault>
<faultcode>sf:INVALID_SESSION_ID</faultcode>
<faultstring>INVALID_SESSION_ID: This session is not valid for use with the API</faultstring>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
Is there something else that I need to add to the System.UserInfo.getSessionId() to avoid having to ask an already signed user for their username, password and security token? in order to use this when calling making a call to the metadata endpoint? (https://xxxxx--sandbox.cs6.my.salesforce.com/services/Soap/m/46.0/00DN0......)