telenordigital / connect-android-sdk

Android SDK for CONNECT ID
https://telenordigital.github.io/id-docs.telenordigital.com/
Other
16 stars 14 forks source link

What should happen if the user ends up in an error situation? #16

Closed jorunfa closed 8 years ago

jorunfa commented 8 years ago

What should happen if a users WebView loses the session and ends up at https://connect.staging.telenordigital.com/id/info ?

Currently the user can escape this page by using the native back button, and then optionally trying again. Should this be changed?

jorunfa commented 8 years ago

Relevant snippet from ConnectWebViewClient.java:

   @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        if (ConnectSdk.getRedirectUri() != null
                && url.startsWith(ConnectSdk.getRedirectUri())) {
            ConnectUtils.parseAuthCode(url, connectCallback);
            return true;
        }
        if (ConnectSdk.getPaymentCancelUri() != null
                && url.startsWith(ConnectSdk.getPaymentCancelUri())) {
            activity.setResult(Activity.RESULT_CANCELED);
            activity.finish();
            return true;
        }
        if (ConnectSdk.getPaymentSuccessUri() != null
                && url.startsWith(ConnectSdk.getPaymentSuccessUri())) {
            activity.setResult(Activity.RESULT_OK);
            activity.finish();
            return true;
        }
        return false;
    }
audunste commented 8 years ago

Based on the error report I got from a user who encountered this, it may be that native back button did not help for trying again, but I can't test whether this is the case, since I can't provoke this error on demand for testing purposes.

jorunfa commented 8 years ago

@audunste: If you change

intent.putExtra(ConnectUtils.LOGIN_AUTH_URI,
                getAuthorizeUriAndSetLastAuthState(parameters).toString());

to

intent.putExtra(ConnectUtils.LOGIN_AUTH_URI,
                "https://connect.staging.telenordigital.com/id/info");

in ConnectSdk.java you can trigger the error page that I know about. You'll get the It's not you, it's us! page. Seemingly the back button works to get back to the app, but it will not take you back in the flow, currently.

audunste commented 8 years ago

Making that change takes me directly to /id/info, am I right?

If so, can I be sure that going back from that /id/info does the same thing as going back from a /id/info that was reached as a result of a real error somewhere in the process?

audunste commented 8 years ago

Interestingly enough, this same thing happened to me just now. I had left the app at first login page, and then later I came back to do the login. I entered my phone number, clicked "Sign in", and then I was presented with the "It's not you, it's us!"-page (which now has a better design and a customer support link).

I tried clicking the device back button, but nothing happened. I tried clicking back several times, and only after the third click did the app respond in any way. It went back to the stage before connect login (which is ok).

Can we do something to make this happen with just one click on back?

audunste commented 8 years ago

Secondly, I assume this may be because of some time out. If so, can we avoid the timeout error in the first place? For a new app user, this can be a normal place to have a big delay. Picture a user downloading the app, clicking "get started" and then when realizing he/she has to sign up, decides that this will have to wait for some other time.

jorunfa commented 8 years ago

Unfortunately, we can't keep the session forever, no, for security reasons.

I'm having some trouble reproducing the bug. Are you able to produce a to-follow list to recreate it?

audunste commented 8 years ago

but you could start a new one instead of showing an error message, secondly there are no security reasons for timing out a session where no info has been entered yet, that is, the user is still at the first login page

jorunfa commented 8 years ago

I belive it is supposed to restart the flow. The second bit I agree with.

jorunfa commented 8 years ago

@audunste: Are you still experiencing incorrect behaviour?

audunste commented 8 years ago

I've added a timeout in the app that makes it start over and reload the connect page if it is resumed 10 minutes or more after it was paused