1. Hi Avnish,

    I did the same way you have mentioned above but I am getting bad request while accessing the oauth token. I tried in all possible ways to solve this but no luck. Can you please help me to solve this issue?

    When I check logs, I see below error -

    CALLOUT_REQUEST|[22]|System.HttpRequest[Endpoint=, Method=POST]
    CALLOUT_RESPONSE|[22]|System.HttpResponse[Status=Bad Request, StatusCode=400]


    Raji M

  2. Hello

    In ReturnAccessToken method you have to pass reqbody value as following

    String reqbody = 'grant_type=password' + '&client_id='+clientId +
    '&client_secret='+clientSecret + '&username='+username + '&password='+password;

    For me its working when i change like above code


    Siri Chandana

  3. hello

    for password field you have to pass

    password = password+security token (Not Access token)

    Creation of Security token :

    Go to your org -> My Settings -> search (Reset My Security Token) ->Check your registered mail -> there you get Security Token


  4. Hey Avnish

    I am getting the same error access_token = null and id = null
    I have added remote setting in both orgs.

  5. Hi Avnish,
    I did the same way you have mentioned above but the error below occurs.
    I have also set Remote Setting for both orgs.

    ''System.JSONException: No content to map to Object due to end of input''

Comments are closed.

Popular Salesforce Blogs