function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
niki4810niki4810 

Changing the login workflow

Hi,

 

Currently the login workflow using salesforce mobile SDK works this way

 

1) Launch your app (first time)

2) If you are not logged into salesforce

    2 a) Show salesforce login page

    2 b) Show permission screen

    2 c) Navigate to the start page specified in bootconfig.json

(or)

2) if already logged in, navigate to start page specified in bootconfig.json (session token is already refreshed)

3) Upon on logout, show the salesforce login page again.

 

 

Is it possible to change this workflow such that

1) Launch your app (first time)

2)If not logged in Show a custom login page. (This just has a sign in button)

     2 a) When button clicked, redirect to regular salesforce login page

     2 b) Show salesforce login page

     2 c) Show permission screen

     2 d) Navigate to the start page specified in bootconfig.json

(or) 

2) if already logged in, navigate to start page specified in bootconfig.json (session token is already refreshed)

3) Upon on logout, show the custom login page again instead of salesforce login page.

 

I looked at some posts

bhariharanbhariharan

This should be achievable, starting with SDK 2.0 and above. The MainActivity that you supply would have a single button to launch the login activity, and when that button is clicked, you can launch LoginActivity with an intent. However, this activity will need to have logic to check if an account exists, and show the button if the account does not exist. If an account exists, it should directly launch the activity that you would go to post-login. The above solution assumes that you're working with the Android Salesforce Mobile SDK. If you're working with the iOS version, deferred authentication is available there too.

niki4810niki4810
@bhariharan,

Thanks for the quick reply. If you have any code snippets, could you please share them here. I will try to look into this as well.

-,
Nikhil
Kevin HawkinsKevin Hawkins
Are you attempting this for iOS or Android, or both?
niki4810niki4810

@kevin I am targeting both IOS and Android. I have a project structure, where most of the js code is shared between ios and android.