Uploaded image for project: 'Moodle QA'
  1. Moodle QA
  2. MDLQA-1 Moodle QA testing
  3. MDLQA-15453

A user can upload badges to their Badgr account when the site is using a different standard

    XMLWordPrintable

    Details

    • Type: Functional Test
    • Status: Open
    • Priority: Minor
    • Affects Version/s: Moodle 3.10
    • Fix Version/s: None
    • Component/s: Badges
    • Labels:
      None

      Description

      Prerequisites

      1. A moodle site that can send emails
      2. A site with public access (use ngrok or similar)
      3. Create a badgr account on badgr.io (US) we will call it the Badgr user account
      4. An admin and a student available in the system.

      OAuth2 setup for OBv2.1

      1. Login as admin.
      2. Access to the "Site home" and "Turn editing on".
      3. Add a label, upload an image there and save changes.
      4. Right-click over the uploaded image and copy the image address. You'll need to replace "https://471f8462.ngrok.io/m/stable_master/pluginfile.php/41/mod_label/intro/logo.png" of the next command to the copied image URL.
      5. Register the oAuth2 service in the IMS Global IdentityServer4 executing the following command, replacing "https://471f8462.ngrok.io/" by your server URL. You'll probably need to adapt "https://471f8462.ngrok.io/m/stable_master/" to your Moodle URL:

        curl --location --insecure --request POST 'https://dc.imsglobal.org/obauth/connect/register' \
        --header 'Accept: application/json' \
        --header 'Content-Type: application/json' \
        --data-raw '
        {
          "client_name": "Badge Moodle",
          "client_uri": "https://471f8462.ngrok.io/",
          "logo_uri": "https://471f8462.ngrok.io/m/stable_master/pluginfile.php/41/mod_label/intro/logo.png",
          "tos_uri": "https://471f8462.ngrok.io/",
          "policy_uri": "https://471f8462.ngrok.io/",
          "software_id": "stablemaster-testing",
          "software_version": "2020041700.01",
          "redirect_uris": [
            "https://471f8462.ngrok.io/m/stable_master/badges/oauth2callback.php"
          ],
          "token_endpoint_auth_method": "client_secret_basic",
          "grant_types": [
            "authorization_code",
            "refresh_token"
          ],
          "response_types": [
            "code"
          ],
          "scope": "https://purl.imsglobal.org/spec/ob/v2p1/scope/profile.update https://purl.imsglobal.org/spec/ob/v2p1/scope/profile.readonly https://purl.imsglobal.org/spec/ob/v2p1/scope/assertion.create https://purl.imsglobal.org/spec/ob/v2p1/scope/assertion.readonly offline_access"
        }'

      6. You should get a result like this. Copy the client_id and the client_secret (you'll need them to configure the oAuth2 service)

        {
          "client_id": "LGC8WEFTxp8",
          "client_secret": "3GAfOtFgflA",
          "client_id_issued_at": 1587110808,
          "client_secret_expires_at": 1618646808,
          "client_name": "Badge OU",
          "client_uri": "https://471f8462.ngrok.io/",
          "logo_uri": "https://471f8462.ngrok.io/m/stable_master-badges/pluginfile.php/41/mod_label/intro/robot-1214536_1920.png",
          "tos_uri": "https://471f8462.ngrok.io/",
          "policy_uri": "https://471f8462.ngrok.io/",
          "software_id": "13dcdc83-fc0d-4c8d-9159-6461da297388",
          "software_version": "54dfc83-fc0d-4c8d-9159-6461da297388",
          "redirect_uris": [
            "https://471f8462.ngrok.io/m/stable_master/badges/oauth2callback.php"
          ],
          "token_endpoint_auth_method": "client_secret_basic",
          "grant_types": [
            "authorization_code",
            "refresh_token"
          ],
          "response_types": [
            "code"
          ],
          "scope": "https://purl.imsglobal.org/spec/ob/v2p1/scope/profile.update https://purl.imsglobal.org/spec/ob/v2p1/scope/profile.readonly https://purl.imsglobal.org/spec/ob/v2p1/scope/assertion.create https://purl.imsglobal.org/spec/ob/v2p1/scope/assertion.readonly offline_access"
        

      7. Go to "Site administration / Server / OAuth 2 services".
      8. Create a custom service with the following information:
        • Name: "IMS Global"
        • Client ID: <previous client_id>
        • Client secret: <previous client_secret>
        • Enable Authenticate token requests via HTTP headers
        • Scopes included in a login request and Scopes included in a login request for offline access: "openid profile email"
        • Service base URL: https://dc.imsglobal.org/obauth
        • Logo URL: https://dc.imsglobal.org/obauth/icon.jpg 
      9. Save changes. 

      OBv2.1 setup - Create new backpack

      1. In Site admin -> Badges -> Manage backpacks
      2. Create a new backpack with the following details :
        1. Backpack API URL - https://dc.imsglobal.org/obprovider/ims/ob/v2p1
        2. Backpack URL - https://dc.imsglobal.org
        3. API Version - Open Badges v2.1
        4. OAuth2 services - IMS Global
      3. Save changes.
      4. Edit the backpack and set OAuth2 services to IMS Global again

      Testing:

      1. Log in as admin and go to Site administration / Badges / Add a new badge.
      2. Add a new badge, setting the criteria as Manual issue by role and tick the Teacher and 'Any of the selected roles' options.
      3. Click the Save button and then the Enable access button.
      4. Click Recipients and then 'Award badge'. Select the student and award them the badge.
      5. Change 'Active external backpack' to the IMS Global provider
      6. Log in as a student, in the user menu (top right), select Preferences then 'Backpack settings' under Badges.
      7. Enter the Badgr user account email, select 'badgr.io' as the backpack and click the button 'Connect to backpack'.
      8. Look in your mailbox for a verification email and copy & paste the link to verify your connection to the backpack.
      9. Back in Moodle, logged in as the student, in the user menu select Preferences then 'Manage badges'.
      10. Verify that your badge is displayed and click on the badge.
      11. Click the button 'Add to backpack'.
      12. Verify that a message 'Added badge to backpack' is displayed.
      13. Go to https://badgr.io, log in with the Badgr user account and verify that the Moodle badge is displayed correctly (though you may need to be patient and wait a few minutes before the badge is displayed in the Badgr backpack).

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: