Embedded Browser oauth SSO redirect to app - UNKNOWN_URL_SCHEME

Embedded Browser oauth SSO redirect to app - UNKNOWN_URL_SCHEME

by Manjunath Moodle -
Number of replies: 5

Moodle Version: Moodle 3.1.1+ (Build: 20160728)  up-to-date. [AWS Ubuntu 14.04] - all plugins up-to-date

Moodle Mobile: 3.1.2 [custom app - phonegap guild published to Play Store]. Issue was observed on stock moodle app also.

Phone: Nexus 5 (6.0.1)

Oauth2 Plugin:  this one

After oauth2 to my google account, while redirection from browser to app, I get attached error(see screenshot) on embedded browser.  You can see http://  getting prefixed to app launch url scheme.

I started debugging launch.php file in local_mobile plugin.  If I change the php header redirect code in the last else block to javascript redirect, it seems to work fine.

} else {
    //header('Location: ' . $location); original code
    //die; original code
?>
    <script type="text/javascript">
       window.location.href = '<?php echo $location ?>';
    </script>
<?php
}

 I tested this code for 'via Browser window (for SSO plugins)' setting also (for chrome browser).  It seems to work fine.

 Not sure if this issue was specific to me or others are also experiencing this behavior.


embedded browser sso redirect error


Average of ratings: -
In reply to Manjunath Moodle

Re: Embedded Browser oauth SSO redirect to app - UNKNOWN_URL_SCHEME

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi,

yes, this was fixed a month ago. We released new versions of the local_mobile plugin with a similar one to your's proposed.

Please, remember to keep update the local_mobile plugin

Juan

In reply to Juan Leyva

Re: Embedded Browser oauth SSO redirect to app - UNKNOWN_URL_SCHEME

by Manjunath Moodle -

Thanks Juan. But I seem to have latest local_mobile plugin. I verified it again. There is no prompt for updates on my moodle site also. am I missing something?

Here is info in plugin version.php (local_mobile)

$plugin->version   = 2016050102;            // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires  = 2016050400;            // Requires this Moodle version.
$plugin->component = 'local_mobile';        // Full name of the plugin (used for diagnostics).
$plugin->maturity  = MATURITY_STABLE;
$plugin->release   = '3.1.312';

I compared the repo (here) with my server plugin code,  It seems up-to-date. May the problem was fixed for iOS  only ('cos I did not face this issue on iPad Air 2) ?   

In reply to Manjunath Moodle

Re: Embedded Browser oauth SSO redirect to app - UNKNOWN_URL_SCHEME

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi,

it seems that you are using a custom app with a custom url scheme (check your config.json and config.xml file), in that case, you must configure local_mobile to use that url scheme.

You can do that in Moodle, in the local mobile plugin settings, there is a field for entering your custom url scheme

Juan

In reply to Juan Leyva

Re: Embedded Browser oauth SSO redirect to app - UNKNOWN_URL_SCHEME

by Manjunath Moodle -

Thank you Juan for replying.   Yes, I have custom app with custom url scheme. I tested again with stock local_mobile plugin code for both embedded browser & external browser with or without customurlscheme (populated in local mobile setting) on both stock moodle app & my custom app. Here are the findings.  For me(at least), issue seems to be with embedded browser.  Please see below observations from my testing.


local_mobile setting stock app custom app
Embedded browser WITH
customurlscheme in local_mobile config
ERR_UNKNOWN_URL_SCHEME (http:// prefixed to customurlscheme on embedded browser address bar) ERR_UNKNOWN_URL_SCHEME ( (http:// prefixed to customurlscheme on embedded browser address bar)
Embedded browser WITHOUT
customurlscheme in config
ERR_UNKNOWN_URL_SCHEME (http:// prefixed to default moodle url scheme on embedded browser address bar) ERR_UNKNOWN_URL_SCHEME ( (http:// prefixed to customurlscheme on embedded browser address bar)
External Browser WITH
customurlscheme in local_mobile config
Opens custom app but gives 'unexpected error' on app (which is fine as we are enforcing customurl scheme) works fine
External Browser WITHOUT
customurlscheme in local_mobile config
works fine works fine

If I use my modified code, I see below behavior -


local_mobile setting stock app custom app
Embedded browser WITH
customurlscheme in local_mobile config
ERR_UNKNOWN_URL_SCHEME (http:// prefixed to customurlscheme on embedded browser address bar) works fine
Embedded browser WITHOUT
customurlscheme in config
works fine works fine
External Browser WITH
customurlscheme in local_mobile config
Opens custom app works fine
External Browser WITHOUT
customurlscheme in local_mobile config
works fine works fine


In reply to Manjunath Moodle

Re: Embedded Browser oauth SSO redirect to app - UNKNOWN_URL_SCHEME

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

HI,

sorry for my late response, we just did a custom app and we tried all the SSO settings in both iOs and Android and it was working correctly for us.

I'm not sure where the problem is, maybe is something specific with the Nexus 5, in any case, we are close to start the testing before the next release of the app so we'll double check all the SSO issues to see if something specific of an Android version

Juan