Please suggest a way to post to salesforce rest resource without using the username and password as the authentication

I’m trying to post to a Salesforce Rest Resource from a java console app. Currently I’m exposing it as a public resource via custom portals.
I’m looking for suggestions for a way to implement the authentication without passing username, password. I have checked OAuth flows but I believe all of them require a callback implementation to read the tokens. It will be helpful if you can suggest a way to authorize in an implicit manner.


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

If you want headless, no-interaction authentication, implement the JWT Flow.

You’ll authorize with a private key and a username, no password. If you “pre-approve” specific Profiles and/or Permission Sets on the Connected App you build in Salesforce, no user interaction of any kind will be required.

The alternative would be to implement another flow, like Web Server, that provides you with a refresh token; in that situation you’d have a user interaction only once and can then act in headless mode via the refresh token.

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x