You need to sign in to do that
Don't have an account?
Rest API Integration
How to do authentication to salesforce from java class using Rest API
Hello,
I want to do authentication from my java client. I got Rest API which authenticate using web Application client and its working fine. But my requirement is little bit different as I need to use normal java client which will authenticate me directly to Salesforce site.
Regards,
Deepak
Yes, you can use the username & password flow that's part of the oauth2 support.
All Answers
You can pass username & password + secuirty Token to Salesforce login class and check that is valid or invalid at our java client. For this, you need to do following steps:--
1. Add WSDl into your java client as web reference. then it will automatically create SOAP functions into your java project.
2. call login salesforce method and pass username & password for authenticate.
You will get proper session id in the response. then you are logged into salesforce.
Thanks for your reply.
Is there any way to use REST API to authenticate login to Salesforce site in java client.
Yes, you can use the username & password flow that's part of the oauth2 support.
Hello Simon,
Thanks for your reply,
I tried to do this way and form once URL as
https://login.salesforce.com/services/oauth2/authorize?grant_type=password&client_id=<Clinet ID>&client_secret=<Clinet secret>&username=<My username>&password=<password + token>
but I am getting
HTTP/1.1 400 Bad Request
error=unsupported_response_type&error_description=response%20type%20not%20supported
as response is there any thing I am missing.
Regards,
Deepak
The request needs to goto the token endpoint, you're using the wrong url. it shouild be /token not /authorize
1. Add WSDl into your java client as web uk 49 predictions for today (https://uk49prediction.com/) reference. then it will automatically create SOAP functions into your java project.
2. call login salesforce method and pass username & password for authenticate.
You will get proper session id in the response. then you are logged into salesforce.