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
Mel LisauMel Lisau 

How can i use OAuth2 with Soap API calls ?

I am currently authenticating into Salesforce by using
Service URL, username and password+securitytoken.

I want users to authenticate using OAuth2 now,(take out the username & password portion) but still make my SOAP calls so I have created a connected app and retrieved my client id and client secret.

If i use the following https://login.salesforce.com/services/oauth2/token?grant_type=password&client_id= <client_id>&client_secret=<client_secret>&username=<username>&password=<password>+ <securitytoken>

Cant i just stay and use normal username , password+securitytoken , what is the real purpose of the Connected App ?

Or do i need to send to https://login.salesforce.com/services/oauth2/authorize ? 

I am trying to do this in a c# mvc app.

Any help with steps involved would be great ?

So basicaly i want to authenticate using my new connected app , but still make Soap calls , not REST , is this possible and do i need to use th new token in my calls to Soap , like adding it to the sessionid ?
 
VinayVinay (Salesforce Developers) 
Hi Mel,

Yes you can use OAuth2 with SOAP api calls,  check below reference.

https://developer.salesforce.com/blogs/developer-relations/2011/03/oauth-and-the-soap-api

However is there any specific reason for not using REST api?  Just go through below example for same for your reference using REST call. 

https://suyati.com/blog/rest-api-oauth2-implementation-salesforce-2/

Please mark as Best Answer if above information was helpful.

Thanks,