I was trying to connect to Salesforce and migrate data from mySQL database to Salesforce using Java. During the connection process I found that we have to give the Username, Password and oAuth token as parameters to the connection URL: https://login.salesforce.com but it seems there was no security in doing this way. Do we have any predefined security mechanism to connect to salesforce from external application say from a JAVA application?

  • 1
    By saying security what you want to achieve. Apr 5, 2016 at 9:30
  • @Kiran Security in the sense i doesn't wanted my password or oAuth token to be tracked
    – Dinesh
    Apr 5, 2016 at 10:24
  • If you already have an OAuth token, you don't need to log in... What's the problem?
    – sfdcfox
    Apr 5, 2016 at 14:18

1 Answer 1


You can use JWT Bearer Token profile - see https://developer.salesforce.com/page/Digging_Deeper_into_OAuth_2.0_on_Force.com#Obtaining_an_Access_Token_using_a_JWT_Bearer_Token

You can register your app's signing certificate in your Salesforce org; your app then signs a JWT referencing a given user and POSTs it to https://login.salesforce.com/services/oauth2/token. If that user is authorized for the app, then the Salesforce authorization server will issue an access token for your app to access APIs on behalf of that user. The app never needs to know the user's password, and the org admin can revoke the app's access at any time by removing its signing cert from the org config.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .