Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-58400

Support new OAuth methods natively in the app

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. First of all, you need to enable OAuth via Google following instructions here: https://docs.moodle.org/dev/OAuth2_Services
      2. Once configured, log-in with a google account in the site.
      3. Once enabled, execute the following curl request

        curl 'http://localhost/m/stable_master/lib/ajax/service.php' --data-binary '[{"index":0,"methodname":"tool_mobile_get_public_config","args":{}}]' | python -m "json.tool"

      4. And check that in the response you see Google listed as an identity provider
      5. As admin, enable Mobile services
      6. Ensure that you are not logged in the site in a new browser (you can use the incognito mode)
      7. Using Chrome or Chromium enable the developer tools, and then enable the "Mobile device emulation" tool (is an icon that displays a phone/tablet) then you canselect Iphone or iPad, this will change the user-agent (so it will be easier to test).
      8. Point your browser to /admin/tool/mobile/launch.php?service=moodle_mobile_app&passport=abc&oauthsso=ID_OF_YOUR_GOOGLE_ISSUER (see bellow), you should be redirected to the Google authentication, after log in (using the same account that in step 2) you should be redirected back to admin/tool/mobile/launch.php
      9. You will see a screen with a link saying "Please, click here if the app does not open automatically", if you inspect the link you must see that points to moodlemobile://token=A_HEX_TOKEN

      ID_OF_YOUR_GOOGLE_ISSUER is the id of your configuration in the table oauth2_issuer

      Show
      First of all, you need to enable OAuth via Google following instructions here: https://docs.moodle.org/dev/OAuth2_Services Once configured, log-in with a google account in the site. Once enabled, execute the following curl request curl 'http://localhost/m/stable_master/lib/ajax/service.php' --data-binary ' [{"index":0,"methodname":"tool_mobile_get_public_config","args":{}}] ' | python -m "json.tool" And check that in the response you see Google listed as an identity provider As admin, enable Mobile services Ensure that you are not logged in the site in a new browser (you can use the incognito mode) Using Chrome or Chromium enable the developer tools, and then enable the "Mobile device emulation" tool (is an icon that displays a phone/tablet) then you canselect Iphone or iPad, this will change the user-agent (so it will be easier to test). Point your browser to /admin/tool/mobile/launch.php?service=moodle_mobile_app&passport=abc&oauthsso=ID_OF_YOUR_GOOGLE_ISSUER (see bellow), you should be redirected to the Google authentication, after log in (using the same account that in step 2) you should be redirected back to admin/tool/mobile/launch.php You will see a screen with a link saying "Please, click here if the app does not open automatically", if you inspect the link you must see that points to moodlemobile://token=A_HEX_TOKEN ID_OF_YOUR_GOOGLE_ISSUER is the id of your configuration in the table oauth2_issuer
    • Affected Branches:
      MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-58400-master

      Description

      Right now it would be possible to log-in using a Facebook/Google/Microsoft account in the mobile app but it will require to launch a browser pointing to the Moodle log-in page where the user would be able to choose to log-in via oauth or an existing account.

      We should be able to avoid launching the browser in first place in the app, this can be easily achieve doing the following changes:

      • Returning the list of oauth-methods enabled via the public ajax web service tool_mobile_get_public_config
      • Supporting redirectiong to oauth methods in admin/tool/mobile/launch.php

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  15/May/17