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
Rajneesh SehgalRajneesh Sehgal 

unable to get authorization code through programming.

Hi All,
I want to get the Authorization code through programming.
I am able to get the Authorization code by invoking the below URL manually,
https://login.salesforce.com/services/oauth2/authorize?response_type=code&client_id={My Client ID}&redirect_uri=http://localhost

By  invoking the URL, it will get redirected to the login page. 
and user has to provide the credentials then it is redirecting to Redirect_Uri and providing the CODE as part of the final redirected URL.

To achieve the same through grammatically, we need to automate the above steps,

Could you please let us know is there any other Api which gives us the Authorization code, 
without involving the user action to provide the user name and password 

As we have Admin credentials, we would like to use the same credentials all the time to generate Access Token behind the screen. 
No Login screen should be expected in between the process.
ShashankShashank (Salesforce Developers) 
Here are the different oauth authentication flows available in salesforce: https://help.salesforce.com/HTViewHelpDoc?id=remoteaccess_authenticate.htm