1

I have 2 different users in force.com i.e user1 and user2. I have developed a rest resource in user1. IF user2 logs in by using a connected app after OAuth authentication, I want to access the rest resource developed in user1 by providing the username,password,clientID,client secret etc.

Is this scenario feasible if so what shud be the callback urL? Here is where I am stuck?

Thanks krishna Casukhela

6
  • Check this nice answer from @Mohith.
    – Mr.Frodo
    Jun 11, 2016 at 12:59
  • I am using sandbox api instance. is it mandatory to create an integration profile? can I manage with system admin profile? Jun 13, 2016 at 14:40
  • It's good to have separate API user profile but not required.You are good to go with admin but do this only for testing purpose.In real time scenario it's too much permission provided to an API user.
    – Mr.Frodo
    Jun 13, 2016 at 14:54
  • Hi cud u pls clarify? I am stuck here. In User1, I have created connected app,enabled Oauth, and set callback url='ap2.salesforce.com/apex/RestApiResponse' where RestApiResponse is an visualforce page. In User2, in remote site settings, I register as "login.salesforce.com", then comes the controller. request.setEndPoint('login.salesforce.com/services/oauth/token'). But the I do not get the JSON string. It shows Invalid URL... Jun 13, 2016 at 16:17
  • did you check the link i shared in my first comment? You won't have any issue if you only follow that.
    – Mr.Frodo
    Jun 13, 2016 at 16:53

1 Answer 1

2

What i have understood from your question is you are using Username and Password flow to get accesstoken aka SessionID. In this flow one does not need a callback URL. You can check it here https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_username_password_oauth_flow.htm

But when you create a Connected app, it asks you provide callback URL(which is used by other 2 Flows of Oauth namely Webserver flow and UserAgent flow) which is not needed by you at the moment. So you can provide dummy value like "https://www.google.com" or any URL starting with HTTPs.

You must log in to answer this question.

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