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
Lance in KlamathLance in Klamath 

Problems getting authenticated for REST API

I'm trying to use the Username-Password OAuth Authentication Flow to connect to REST

Posting to https://test.salesforce.com/services/oauth2/token
Params
   grant_type = password
   client_id     = from connected app
   client_secret = from connected app
   username = my user name
   password = my password and API token

I'm getting 
   {"error":"invalid_grant","error_description":"authentication failure"}

When I look at my user in salesforce I see this error
    Failed: Login over insecure channel

I'm setting https.protocols = TLSv1,TLSv1.1,TLSv1.2

Any thoughts?
{!pramod_nishane}{!pramod_nishane}
Hi Lance,

I suggest you to double check your client_id ,client_secret  and password because i tried the same thing through POSTMAN and it is working fine for me if i set all attributes to correct values.
also  password = my password and API token - here API token is security Token right?

Thanks,
Pramod Nishane
Salesforce Consultant
Varasi LLC
www.varasi.com
Lance in KlamathLance in Klamath
Actually my problem was that was using an old apache HTTP Client that did't support TLSv1.1.  When I switched to a new version, and set it to 1.1 it worked.