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.

Here is my case study:

  • We are developing a mobile app.

  • The mobile app interacts with two salesforce orgs i.e.

    1. Metadata org : Having all the customer metadata required by mobile app for each customer.
    2. Real customer salesforce org: This org is real customer org they use for their CRM or other use.

One way to use both orgs with mobile app is to Oauth with both of them and store the tokens. But that would require us making the customer do OAuth requests two times.

One way I see, is to use Salesforce Auth provider and make user click on the Auth Provider SSO URL(iPhone WebView can be used) to create user in Metadata org. But we don't have a way to again get the auth token for the newly created user.

Whats best way to deal with this, that requires minimal OAuth flows ?

share|improve this question
2  
I would handle the Metadata org credentials as my app settings as that won't change very often. If you are using the mobile sdk, you should use the oAuth webview to authenticate against hte real customer org and once that's done, authenticate with your metadata org using an AJAX request. This will ensure that your users do not need to authenticate against metadata every time as it doesn't really make sense. So, users will essentially need to auth only once in the login flow (only if they logout from the real customer org). –  Gaurav Kheterpal Jan 9 '13 at 11:40
    
This is good detail +Gaurav, thanks I will try that ! –  Abhinav Gupta Jan 9 '13 at 15:42
add comment

1 Answer

Use the SessionHeader field on the sforceservice to instantiate the metadataservice object. This way, the metadata api can piggy back off of the already authenticated sforceservice api object.

share|improve this answer
    
You're describing how to use two APIs in the same org - question is how to use APIs from two different orgs. –  metadaddy Mar 11 '13 at 15:26
add comment

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.