0

This is my request URL

https://login.salesforce.com/services/oauth2/authorize?client_id=**clientId**&client_secret=**clientSecret**&redirect_uri=https://localhost:8443/RestTest/oauth/_callback&response_type=token

I am expecting access token, but getting a response body as below:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
        <script>
function redirectOnLoad() {
if (this.SfdcApp && this.SfdcApp.projectOneNavigator) { SfdcApp.projectOneNavigator.handleRedirect('https://login.salesforce.com/?ec=302&startURL=%2Fsetup%2Fsecur%2FRemoteAccessAuthorizationPage.apexp%3Fsource%3DCAAAAWlczUkIME8wNkYwMDAwMDA0Qzk2AAAA2o0tf7K3wMfXx9vd30KKRdruSEafSnsnv-Zt-6JQubWPyjrit5g4ZLafrhyiyePWfaBKFxUW-NBLiK1prAZKbIM1NN7rtUKlwLgni9EIW0vfUpAq0Shgylw9ivYo3mMIJxafRDEjUsrglOUJm35hhBd3sLd7ktoLF4qN5KRzYCbC0qlmcME8voReXXEuVcCSOdH4i_ydBDzMSeqQQXRbLy6Lq0IaX7UM4yZUBo50DRtcwlqjV0IbRz86h0jxm3X_guEI4hDDUOSWfy_829xenZprl03xSlqKqvhsun9VTZaQMNXQ7ThAuI9jYs5A1TrYnwreWc2QOdlzCOJwWcxeoy5Mw7P9k1E79e8psuQOes4xbG3Fk1ZVQ3gGcfm8UNmgM4GxJubC8Zgbc6piTyTX1RepTB-OwVwByM-vGnqoQEg1ElEco_2zbM0_y72LWlrhACXsHTt2Y86HzmsAV_nIfTFJG1jN9Ic4uxRl1MWEobRsiWFRcZv1LUfbqNxe56njqThu5eeipRtZWuyKS_ks_mTjQMfRm8mxOK-qtHVOO8G6jLeXo6644SNpdhEi60xIYj6LnSE3W1LIxKYfIYJpPFdsrRE_x_uB4RTe7e0p6sDJpnPV8k5TtLy6YuNIiOHOAw%253D%253D'); }  else 
if (window.location.replace){ 
window.location.replace('https://login.salesforce.com/?ec=302&startURL=%2Fsetup%2Fsecur%2FRemoteAccessAuthorizationPage.apexp%3Fsource%3DCAAAAWlczUkIME8wNkYwMDAwMDA0Qzk2AAAA2o0tf7K3wMfXx9vd30KKRdruSEafSnsnv-Zt-6JQubWPyjrit5g4ZLafrhyiyePWfaBKFxUW-NBLiK1prAZKbIM1NN7rtUKlwLgni9EIW0vfUpAq0Shgylw9ivYo3mMIJxafRDEjUsrglOUJm35hhBd3sLd7ktoLF4qN5KRzYCbC0qlmcME8voReXXEuVcCSOdH4i_ydBDzMSeqQQXRbLy6Lq0IaX7UM4yZUBo50DRtcwlqjV0IbRz86h0jxm3X_guEI4hDDUOSWfy_829xenZprl03xSlqKqvhsun9VTZaQMNXQ7ThAuI9jYs5A1TrYnwreWc2QOdlzCOJwWcxeoy5Mw7P9k1E79e8psuQOes4xbG3Fk1ZVQ3gGcfm8UNmgM4GxJubC8Zgbc6piTyTX1RepTB-OwVwByM-vGnqoQEg1ElEco_2zbM0_y72LWlrhACXsHTt2Y86HzmsAV_nIfTFJG1jN9Ic4uxRl1MWEobRsiWFRcZv1LUfbqNxe56njqThu5eeipRtZWuyKS_ks_mTjQMfRm8mxOK-qtHVOO8G6jLeXo6644SNpdhEi60xIYj6LnSE3W1LIxKYfIYJpPFdsrRE_x_uB4RTe7e0p6sDJpnPV8k5TtLy6YuNIiOHOAw%253D%253D');
} else {
window.location.href ='https://login.salesforce.com/?ec=302&startURL=%2Fsetup%2Fsecur%2FRemoteAccessAuthorizationPage.apexp%3Fsource%3DCAAAAWlczUkIME8wNkYwMDAwMDA0Qzk2AAAA2o0tf7K3wMfXx9vd30KKRdruSEafSnsnv-Zt-6JQubWPyjrit5g4ZLafrhyiyePWfaBKFxUW-NBLiK1prAZKbIM1NN7rtUKlwLgni9EIW0vfUpAq0Shgylw9ivYo3mMIJxafRDEjUsrglOUJm35hhBd3sLd7ktoLF4qN5KRzYCbC0qlmcME8voReXXEuVcCSOdH4i_ydBDzMSeqQQXRbLy6Lq0IaX7UM4yZUBo50DRtcwlqjV0IbRz86h0jxm3X_guEI4hDDUOSWfy_829xenZprl03xSlqKqvhsun9VTZaQMNXQ7ThAuI9jYs5A1TrYnwreWc2QOdlzCOJwWcxeoy5Mw7P9k1E79e8psuQOes4xbG3Fk1ZVQ3gGcfm8UNmgM4GxJubC8Zgbc6piTyTX1RepTB-OwVwByM-vGnqoQEg1ElEco_2zbM0_y72LWlrhACXsHTt2Y86HzmsAV_nIfTFJG1jN9Ic4uxRl1MWEobRsiWFRcZv1LUfbqNxe56njqThu5eeipRtZWuyKS_ks_mTjQMfRm8mxOK-qtHVOO8G6jLeXo6644SNpdhEi60xIYj6LnSE3W1LIxKYfIYJpPFdsrRE_x_uB4RTe7e0p6sDJpnPV8k5TtLy6YuNIiOHOAw%253D%253D';
} 
} 
redirectOnLoad();
</script>
    </head>
</html>
<!-- Body events -->
<script type="text/javascript">function bodyOnLoad(){if(window.PreferenceBits){window.PreferenceBits.prototype.csrfToken="null";};}function bodyOnBeforeUnload(){}function bodyOnFocus(){}function bodyOnUnload(){}</script>
</body>
</html>
<!--
...................................................................................................
...................................................................................................
...................................................................................................
...................................................................................................
-->

Am I missing something or doing something wrong? Please help. TIA!

1 Answer 1

1

I it is related to where you put your parameters, they should go in the body, so that your url is

This is my request URL https://login.salesforce.com/services/oauth2/token

and your body could be something like this:

grant_type:password

client_id:{{consumerkey}}

username:{{username}}

password:{{password}}{{token}}

client_secret:{{consumersecret}}

using bulk edit. Note that granttype here is password.

More information can be found here: https://help.salesforce.com/articleView?id=remoteaccess_oauth_web_server_flow.htm&type=5

3
  • I want it without username and password Mar 8, 2019 at 9:16
  • 1
    If you don't want to provide user name and password you should use OAuth 2.0 Web Server Authentication Flow. Mar 8, 2019 at 9:25
  • For more details on diffrent types of oAuth flow here is link. help.salesforce.com/… For more details about the OAuth 2.0 Web Server Authentication Flow here is link: help.salesforce.com/… Mar 8, 2019 at 9:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .