function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
VenkataRajaVenkataRaja 

{"error_description":"ip restricted or invalid login hours","error":"invalid_grant"}

Hi all,

I am getting this error when I call Tooling API from @future(Callout = true) method. I was set IP address in profile settings whatever provided by salesforce
http://help.salesforce.com/apex/HTViewSolution?id=000003652&language=en_US (http://help.salesforce.com/apex/HTViewSolution?id=000003652&language=en_US)

since I am getting same error. It is working good in my dev edition, but not working in my sandbox. 
This error I am getting, when I tried to get access_token from http callouts.
HttpRequest req1 = new HttpRequest();
        req1.setEndpoint('https://test.salesforce.com/services/oauth2/token');
        req1.setMethod('POST');
        req1.setHeader('Content-Type','application/x-www-form-urlencoded');
        req1.setBody('grant_type=password' +
            '&client_id=<ClientId_from ConnectedApps>' +
            '&client_secret=<Client Secret from ConnectedApp>' +
            '&username=<UserName>' +
            '&password=<Password>');
       
        Http http = new Http();
        HttpResponse response1 = http.send(req1);
       
        System.debug('BODY: '+response1.getBody());
getting error on hilighted.

Thanks 
Venkat

Ashish_SFDCAshish_SFDC
Hi Venkat, 


You need to use your api security token in addition to your password, see the online help on identity confirmation.

See more details in the thread below,

https://developer.salesforce.com/forums?id=906F000000099znIAA


Regards,
Ashish