Custom Login Domain for SalesforceSDKManager

402 Views Asked by At

I'm trying to get my app to to redirect to my custom salesforce URL, instead of the default one. I can't seem to find a "login domain" option in the SalesforceSDKManager, like there was for the SFUserAuthenticationManager. So, my question is how the heck to do I do this? This is what my set up looks like so far (written in swift)

SalesforceSDKManager.sharedManager().connectedAppCallbackUri = CALLBACK_URI
SalesforceSDKManager.sharedManager().connectedAppId = CONSUMER_KEY
SalesforceSDKManager.sharedManager().authScopes = ["web", "api"]
SalesforceSDKManager.sharedManager().launch()

Anyone have any thoughts on this (objective-c answers welcome, I'll simply translate them)?

2

There are 2 best solutions below

0
On BEST ANSWER

Okay, so I was able to solve this. The key is to set the SFUserAccountManager before launching the SFSDKManager. Like so:

    var sfUserAccountManager = SFUserAccountManager.sharedInstance()
    sfUserAccountManager.loginHost = LOGIN_DOMAIN
    sfUserAccountManager.oauthClientId = CONSUMER_KEY
    sfUserAccountManager.oauthCompletionUrl = CALLBACK_URI

Hope this can help someone

0
On

Another(better) way to do this is to set the custom login endpoint