Debugging mobile app SSO via chromium & ionic serve

Debugging mobile app SSO via chromium & ionic serve

Brian Merritt發表於
Number of replies: 6

We are just getting back to Moodle mobile development, and things are much improved but different.

I've done all the app development setup found in https://docs.moodle.org/dev/Setting_up_your_development_environment_for_Moodle_Mobile_2


We have both live and demo servers on Moodle 3.7 set up which work with the standard Moodle mobile app and our SSO (opening a new browser window), but when I run 


    ionic serve

On the integration branch of the Moodle mobile 2 app (latest version) everything appears to work fine until I try to point to the same url that works on the mobile.  I get the "must open new browser" window but the URL appears to be bad.  https://example.com/local/mobile/launch.php?service=local_mobile&passport=nnn.nnnnnnnnnn&urlscheme=moodlemobile

There is no mobile/launch.php in /local/mobile, so I'm not sure what is happening.

I've tried the above in both normal browser and incognito mode but get the same results.

Should I be on a different branch?  Am I doing something wrong?  I would hope to debug using chromium or similar browser rather than develop mobile add ins on a device or emulator.

評比平均分數: -
In reply to Brian Merritt

Re: Debugging mobile app SSO via chromium & ionic serve

Brian Merritt發表於
I've had a look at local/mobile and can't find a "launch.php" in older versions either, but just to confirm we are on the 3.7 branch of local mobile app and the moodlemobile2 app does point to local/mobile.launch.php.

We do have admin/tool/mobile/launch.php but despite the fact I am on an open browser (chromium) it appears that with "ionic serve" the browser is somehow confusing and probably guessing we are running an android mobile app version (the latter is just a guess).

I don't understand why the mobile2 app references a "launch.php" url on the server under /local/mobile when there is not such file.

Confused!!!
In reply to Brian Merritt

Re: Debugging mobile app SSO via chromium & ionic serve

Mark Johnson發表於
Core developers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片

If you are running the app via ionic serve, you won't be able to log in via SSO. You will need to either install the Moodle Desktop app, or build your own. If you've got as far as ionic serve working and you've got all the electron dependencies, it should just be a case of npm run desktop.pack.

In Moodle Desktop, Ctrl+Alt+I will open the developer tools.

In reply to Mark Johnson

Re: Debugging mobile app SSO via chromium & ionic serve

Brian Merritt發表於
Hi Mark, many thanks.

I checked out desktop, re-ran npm install and ionic serve (lazy way to get build done) then npm run desktop.pack.

When I then run "electron ." the app loads fine and I get as far as the sso opening the new window and loggin in and then the second window gets stuck on "loading..."

I can web inspect the main window but can't get web inspector running on the failing sso popup.
In reply to Mark Johnson

Re: Debugging mobile app SSO via chromium & ionic serve

Brian Merritt發表於
So I can download the electron linux desktop app from Moodle, and sso works fine. The open in new browser opens the browser window, I login via sso, and then it returns to the desktop app.

However, when I for example checkout out the integration branch and run

npm install
ionic build
npm run desktop.pack

or

npm run desktop.dist

And then

electron . (which loads the electron moodle mobile app)

The sso login works but gets stuck on loading
附件 ssoloading.png
In reply to Brian Merritt

Re: Debugging mobile app SSO via chromium & ionic serve

Mark Johnson發表於
Core developers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片

Instead of running electron ., what if you run desktop/dist/xx-unpacked/Moodle Desktop? (I am on Windows, so I'm guessing at the exact path to the executable).