title: How to get the access_token first in Apex Restful service to call GET/POST methods from outside?
body: <p>I am doing Salesforce trailhead from the link : <a href="https://trailhead.salesforce.com/modules/apex_integration_services/units/apex_integration_webservices" rel="nofollow noreferrer">https://trailhead.salesforce.com/modules/apex_integration_services/units/apex_integration_webservices</a>. </p>
  
  <p>In this tutorial they've use <code>access_token</code> to call the <code>GET</code> request. <strong>But they have not guided us how to get the</strong> <code>access_token</code>, which is an important steps to call the APEX Rest from outside.</p>
  
  <p><a href="https://i.stack.imgur.com/ZtvxV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZtvxV.png" alt="enter image description here"></a></p>
  
  <p>I tied to do something like below its saying me the error:</p>
  
  <pre><code>https://ap5.salesforce.com/services/oauth2/token?client_id="3MVG9d8..z.hDcPJZPIzGJ5UZDuKCOqbH8CCGCPnmwQuRbwLZ_2f.thbqWMX82H7JRGx4
  6VYyEkuwzQ9._ww5"&amp;client_secret="1180508865211885204"&amp;username="pXXXXXXXXXXXXXXX.com"&amp;password="AgXXXXXXXX"&amp;grant_type=password
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/219lz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/219lz.png" alt="enter image description here"></a></p>