Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

We would want to use the user agent flow for our desktop application that we connect to Salesforce via the REST API.

Does anyone have somewhere a working java example of this or point me in the good direction with more information on how this works for desktop applications? Most information that I find is about web applications connecting to Salesforce but not so much for desktop apps.

Thanks in advance!

share|improve this question
    
So you want to create a Visual Workflow in Salesforce and have a desktop application implement it? –  Mike Chale Nov 20 '12 at 12:23
    
Hi Mike. No, I have a java desktop application that connects to Salesforce via the REST api. We now just used the authentication by passing the username, password and token to retrieve the access token but we would rather want to use the user-agent authentication. –  KoenVM Nov 20 '12 at 12:47

1 Answer 1

This seems to be a good resource for libraries out there. In which I found what seems to be quite a popular Java library called Scribe. It does not list Salesforce oAuth support, but in theory it should work just as well as any of the others claimed to be supported.

Update: It appears that there has been some activity around using this library with the Salesforce oAuth implementation see here.

Scribe is a mature OAuth library for Java by Pablo Fernandez that is intended to work with all APIs. It has been featured in LinkedIn's developers forums and works with Google, Yahoo, LinkedIn, Twitter, and Foursquare APIs out of the box.

OAuthService service = new ServiceBuilder()
.provider(LinkedInApi.class)
.apiKey(YOUR_API_KEY)
.apiSecret(YOUR_API_SECRET)
.build();
share|improve this answer
    
Hi Andrew, thanks for this! This seems usefull. There was actually someone who already did some work to have a "Salesforce API" in Scribe: github.com/fernandezpablo85/scribe-java/pull/194 . –  KoenVM Nov 20 '12 at 12:50
    
Nice, glad I was able to help, I've updated my answer to include this link. –  Andrew Fawcett Nov 20 '12 at 20:36
    
Andrew... I want to create a web based java application that connects to Salesforce and need to perform CRUD operation on salesforce database. Can you please help me in doing this. Also if possible can you post your desktop application code. Thanks in advance. –  kapil Jan 23 '13 at 13:32
    
@kapil - look at wiki.developerforce.com/page/… (for REST) and wiki.developerforce.com/page/… (for SOAP) –  metadaddy Jan 23 '13 at 15:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.