• Jim@SupportPay
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hybrid-remote App Timing out to Salesforce Login Screen

We are having a problem with a hybrid-remote app that is going to the Salesforce login screen instead of the app login screen after the session times out. We have a custom login page and in the controller uses Site.login. After the session times out the app goes to the Salesforce login instead of the custom app login. While at the Salesforce login page the Xcode log is in an authentication loop. Killing the app and relaunching and the user is automatically logged back into app.

If the user is logged in, when the session times out then they are incorrectly taken to a Salesforce login screen instead of being automatically re-logged in or taken to our login screen.

If they end up timed out and on the incorrect Salesforce login screen, they need to kill the app, reopen it, and only then they are correctly automatically re-logged in and taken to the Dashboard screen.

How can we get the timeout go to the correct app login screen?

———————————————

1. Version of Mobile SDK Used: 
5.0.1

2. Issue found in Native App or Hybrid App:
Hybrid-remote apps created using 'forceios create’ and 'forcedroid create'

3. OS Version:
iOS 10.3.1, 6.0.1, etc

4. Device:
iPhone 6s, Nexus, etc

5. Steps to reproduce:
Login to app, wait until session timeout, try to do anything. 

6. Actual behavior:
Taken to Salesforce login screen.

7. Expected Behavior:
Taken to custom login screen.

8. Error Log:
While at Salesforce login screen the Xcode log is in a loop.

———————————————

Side note: calling:
var sfOAuthPlugin = cordova.require("com.salesforce.plugin.oauth");
sfOAuthPlugin.logout();
takes the user back to the correct app login screen.

Another side note:
Getting OAuth erros screen:
5. Steps to reproduce:
Login to app, get the “Allow Access” screen, wait until session timeout, tap “Allow". 
6. Actual behavior:
Taken to OAuth Error screen.
7. Expected Behavior:
Taken back to custom app login screen.
 
We have a remote hybrid application built to access our custom salesforce site / portal for users that works fine on Android. However, in iOS after the user "allows" access of the application to the device the user arrives at a blank screen and never gets to the remote start page. 

The app works as expected on Android but not iOS.

We are using the current version of the mobile SDK (as of 4/10/2017) and cordova.

After the user allows access the debug log shows a redirect to window.location.href ='sfdc:///mobilesdk/detect/oauth/done#access_token=00D0S0000000Sw0%21ARwAQJVgzJr4kOJYszH2wB4bo.qhpkjuW...';
yet the user results in the blank page

We did notice in the Authorization.html there is an extra semicolon in the javascript code which is 
 
a if (window.location.replace) {
            window.location.replace('sfdc:///mobilesdk/detect/oauth/done#access_token=00D0S0000000Sw0%21ARwAQFTXNGs.5BW1oFPwUwhfXBMgDcMu91dr3gy5T.330la91TMI0MmdY.y431Mk8jrCEc5qNYyb2huMbVwoMH1Cl0_p7fm1&refresh_token=5Aep861iWZIx.jFK3ff0qhSFrdiV.vtGRI8PxLJrY5egow5otilivGoVJqREZ.11PKWMfRVdxF4POpwR2WXTjkt&instance_url=https%3A%2F%2Fcs54.salesforce.com&id=https%3A%2F%2Ftest.salesforce.com%2Fid%2F00D0S0000000Sw0UAE%2F0050S000000TY9HQAW&issued_at=1491859024363&signature=NNF8HR6SxMWpOn%2F%2BKITfxmKnm1H8%2FjwDMgDNCPEbxAw%3D&scope=api+web+refresh_token&token_type=Bearer');
        } else {;
            window.location.href = 'sfdc:///mobilesdk/detect/oauth/done#access_token=00D0S0000000Sw0%21ARwAQFTXNGs.5BW1oFPwUwhfXBMgDcMu91dr3gy5T.330la91TMI0MmdY.y431Mk8jrCEc5qNYyb2huMbVwoMH1Cl0_p7fm1&refresh_token=5Aep861iWZIx.jFK3ff0qhSFrdiV.vtGRI8PxLJrY5egow5otilivGoVJqREZ.11PKWMfRVdxF4POpwR2WXTjkt&instance_url=https%3A%2F%2Fcs54.salesforce.com&id=https%3A%2F%2Ftest.salesforce.com%2Fid%2F00D0S0000000Sw0UAE%2F0050S000000TY9HQAW&issued_at=1491859024363&signature=NNF8HR6SxMWpOn%2F%2BKITfxmKnm1H8%2FjwDMgDNCPEbxAw%3D&scope=api+web+refresh_token&token_type=Bearer';
        }
The host is set correctly in info.plist and we have tried everything and still can't find a solution. Any suggestions?