Show
Before upgrade :
Prerequisites
SMTP setup for the site, perhaps using mailcatcher.
Run your site with public access (use ngrok or similar)
Create 3 badgr account on badgr.io (US)
Account 1 as Admin (Use as system badge account)
Account 2 and 3 as Student/Regular user accounts
Create another account on eu.badgr.io (Use as user badge account)
An admin and 5 students available in the system.
Setup badges for the Moodle site as described here :
In "Site administration / Badges / Badges settings", set the issuer site backpack with Badgr Account1
In "Site administration / Badges / Manage backpacks", edit the https://badgri.io backpack and set the password.
As student1, go to "Dashboard / Preferences / Badges / Backpack settings", connect Badgr (ussing Account2) and set it to a 'Connected' state (you'll need to check the email to verify the account).
OAuth2 setup for OBv2.1
Login as admin.
Access to the "Site home" and "Turn editing on".
Add a label, upload an image there and save changes.
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.
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"
}'
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"
Go to "Site administration / Server / OAuth 2 services".
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
Save changes.
OBv2.1 setup - Create new backpack
In Site admin -> Badges -> Manage backpacks
Create a new backpack with the following details :
Backpack API URL - https://dc.imsglobal.org/obprovider/ims/ob/v2p1
Backpack URL - https://dc.imsglobal.org
API Version - Open Badges v2.1
OAuth2 services - IMS Global
Save changes.
Edit the backpack and set OAuth2 services to IMS Global again (this is a workaround for MDL-70025 ).
After upgrade
Testing Instructions :
Apply the patch and proceed through the upgrade steps
Log in as an admin
Upgrade the site
Go to Site admin -> Badges -> Manage backpacks
Confirm the previously setup backpacks exist with their auth details setup.
Create this backpack with the following details:
Backpack API - https://api.eu.badgr.io/v2
Backpack URL - https://eu.badgr.io
API Version - Open Badges v2.0
Include authentication details with the backpack - Disabled
Confirm you do not have any issues creating the backpacks as defined.
Go to Site Admin -> Badges -> Add a new badge
Follow the details here to create a new badge with the setting
Criteria - 'Manual issue by role' - Teacher
Enable access
Award the badge to all of the students
Log in as student 1 and go to the Preferences -> Badges -> Backpack settings
Confirm the backpack is still marked as connected.
Log in as student 2
Go to Preferences -> Backpack settings
Confirm you can select the backpack provider
Select and add the credentials for the eu backpack and save
Go to your email used to register the eu account.
Click on the confirmation link in the email sent from Moodle.
Confirm the backpack is now displayed as connected in your Moodle site.
Go to 'Manage badges' in the user preferences.
In the listed badges, click on the add to backpack.
Confirm you see the 'Added badge to backpack' message
Log in to the eu badgr account and confirm you see the badge you created on Moodle in your backpack (sometimes waiting for a few minutes is required before the badges are displayed in the badgr backpak)
In the eu badgr account, create a collection with some of the badges awarded and mark it as public
As student2, go to Preferences -> Backpack settings
In 'Badge import settings', confirm the collection created is listed here.
Enable the checkbox against the collection listed and save changes
Confirm you are taken to the 'My badges' page and can see the badges from the collection under 'My badges from other web sites'
Cross standards update - OB2 Site backpack -> OBv2.1 User backpack
As student 3 go to Preferences -> Backpack settings
Select the "IMS Global" provider
Confirm you only see the Backpack provider and status fields
Proceed with connecting to the backpack using the OAuth2 workflow:
First you'll need to grant the permission clicking the "Yes, allow" button.
Then you'll need to add the credentials alice / alice , for instance (credentials shown on the provider's page)
After the OAuth flow, confirm you are redirected to your Moodle site and are shown the badges that you're awarded.
In the listed badges, click on the add to backpack.
Confirm you see the 'Added badge to backpack' message
Cross standards update - OB2.1 Site backpack -> OBv2 User backpack
As an admin, go to "Site administration / Badges / Backpack settings"
Change 'Active external backpack' to the IMS Global provider
As student 1 (Backpack should already be connected from before)
Go to 'Manage badges' in the user preferences.
In the listed badges, click on the add to backpack
Confirm you see the 'Added badge to backpack' message
Log in to the student's badgr account and confirm you see the badge you created on Moodle in your backpack
Repeat #14-#289 as student 4 and with the 3rd US Badgr Account