+ Start a Discussion
Pedro SallesPedro Salles 

How to do a SOAP / REST authentication?

Hello everyone.

I'm new to Salesforce and need to create authentication for a Webservice call.
I read in some content and in the Trailhead itself ways of doing this authentication, but the only one I have managed to do so far is authentication via SOAP.
My calls will all be REST.

Now my points of doubt:
Could I use this SOAP authentication to open a session and then use REST calls to exchange information?
Or would it be better for me to perform REST authentication to start the information exchange?
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com">
   <soapenv:Header>
      
   </soapenv:Header>
   <soapenv:Body>
      <urn:login>
         <urn:username>login@example.com</urn:username>
         <urn:password>passowordcQZYyxtJFwSDrmb4eSp4B3X</urn:password>
      </urn:login>
   </soapenv:Body>
</soapenv:Envelope>
My response:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <loginResponse>
         <result>
            <metadataServerUrl>https://cs71.salesforce.com/services/Soap/m/43.0/00D4D0000000Ndl</metadataServerUrl>
            <passwordExpired>false</passwordExpired>
            <sandbox>true</sandbox>
            <serverUrl>https://cs71.salesforce.com/services/Soap/c/43.0/00D4D0000000Ndl/0DF4D00000000Kf</serverUrl>
            <sessionId>00D4D0000000Ndl!ARUAQNbw2wA6Kl5mrvQOsGrKloCPYGg.u1OQVmLg68DSYUbk5rLrUrX60S820uAMGVRMeT0x182P4OlgbO24hZIJ0</sessionId>
            <userId>0054D000000uhEdQAI</userId>
            <userInfo>
               <accessibilityMode>false</accessibilityMode>
               <chatterExternal>false</chatterExternal>
               <currencySymbol>R$</currencySymbol>
               <orgAttachmentFileSizeLimit>5242880</orgAttachmentFileSizeLimit>
               <orgDefaultCurrencyIsoCode>BRL</orgDefaultCurrencyIsoCode>
               <orgDefaultCurrencyLocale>pt_BR</orgDefaultCurrencyLocale>
               <orgDisallowHtmlAttachments>false</orgDisallowHtmlAttachments>
               <orgHasPersonAccounts>false</orgHasPersonAccounts>
               <organizationId>00D4D0000000NdlUAE</organizationId>
               <organizationMultiCurrency>false</organizationMultiCurrency>
               <organizationName>Raia Drogasil S/A</organizationName>
               <profileId>00eA0000000lgNeIAI</profileId>
               <roleId xsi:nil="true"/>
               <sessionSecondsValid>7200</sessionSecondsValid>
               <userDefaultCurrencyIsoCode xsi:nil="true"/>
               <userEmail>example@example.com</userEmail>
               <userFullName>Pedro Salles</userFullName>
               <userId>0054D000000uhEdQAI</userId>
               <userLanguage>pt_BR</userLanguage>
               <userLocale>pt_BR</userLocale>
               <userName>Pedro Salles</userName>
               <userTimeZone>America/Sao_Paulo</userTimeZone>
               <userType>Standard</userType>
               <userUiSkin>Theme3</userUiSkin>
            </userInfo>
         </result>
      </loginResponse>
   </soapenv:Body>
</soapenv:Envelope>
Can someone help me?

Thanks