I want to share my experience with Badgr and the Badging feature. I am using Nutmeg and devstack.
Badgr is now part of Canvas, so some references in docs are broken since those belong to the Canvas domain now. Before diving into Badgr and its usage within the OpenEdx ecosystem, I would recommend to get familiar with the core data classes of the Open Badges specification, such as: Assertions, BadgeClasses, and Profiles. Useful resources for this post:
- OpenBadges Specification
- Badgr website
- Badgr API
- Postman API Collection (the link in the Badgr API is broken so I created this one)
In order to use Badging with Badgr, I will guide you with help of the following diagram which is based on Course Completion Badge generation.
Letβs set up the Badgr Server
Before the question arises. The Issuer term that you will find in the Badgr Website is equivalent to the Profile class in the OpenBadges specification. The issuer issues badges.
- Go to the Badgr Website and create an account. In case you sign up with Google, Facebookβ¦, etc, you still need to set up a password for next steps. You will be able to set/change the password in Account Settings.
- You can create the issuer manually. However, I think that It is worth creating it using the Badgr API. If using the API you will get the result[0].entityId from the response of the post request.
{
"status": {
"success": true,
"description": "ok"
},
"result": [
{
"entityType": "Issuer",
"entityId": "somethinglikethis123ABC",
...
}
...
}
If you created the issuer manually, then select the issuer in the website and you will find the entityId in the URL https://badgr.com/issuers/somethinglikethis123ABC/badges
. The entityId value is going to be used to configure Badgr in our LMS.
All right, you are all done. You could now create Badges and Assertions with the API to fully understand what the LMS does and to be aware of the required fields for each request. But, there is really no need to create Badges and Assertions since the LMS will create them for us.
Configure Badging with Badgr server.
- Make sure Certificates are enable.
COURSE_CERT_AWARDED
signal is the trigger for Badges awarded from Course Completion events, therefore the following functions wonβt work if Certificate generation isnβt enabled. No certificates, then no these type of Badges.
- Enable and Configure OPENBADGES
Edit lms.yml
with the following variables. Same credentials yo use in the Badgr website.
BADGR_USERNAME: "admin@mail"
BADGR_PASSWORD: "password_used_by_admin@mail"
BADGR_TOKENS_CACHE_KEY: "secret-cache-key"
BADGR_BASE_URL: "https://api.badgr.io"
BADGR_ISSUER_SLUG: "somethinglikethis123ABC"
Edit both lms.yml
and studio.yml
with the following variables:
FEATURES:
ENABLE_OPENBADGES: true
Now go to Django admin to set something as default for the CourseCompleteImageConfiguration model. http://localhost:18000/admin/badges/coursecompleteimageconfiguration/
. I set the verified mode as default and also updated the Icon. See Issue 1 in the Issues section of this post to find out why this procedure/workaround is required.
At this point we are ready to support Badges in our platform.
Configure and get a Course Completion Badge.
This type of badge is configured by default, so the only remaining work for us is to configure certificates for a course. Once a student gets a passing grade, then the signals which were mentioned in step 3 will generate the Badge.
-
Create a graded course and activate the certificate. You might need to add the course as Verified in eComm. I have added it as Audit and Verified. Donβt forget to preview the certificate to check everything is working as expected.
-
Use a user with a real email to enroll in the verified track and complete the graded subsections. The idea of using an existing email is to see our Badge once we earned. See Issue 3.
If everything is well configured, then the LMS/Badgr server implementation is going to do all the magic.
What happens behind Course Completion?
Once the user reached a passing grade, then COURSE_CERT_AWARDED
signal is emitted and therefore captured by create_course_badge
.
BadgeClass is created in LMS here get_badge_class. It is created once the first student completes the course.
BadgeClass is created in Badgr here _ensure_badge_created, before awarding --creating the assertion for-- the first student.
Assertion is created for both LMS and Badgr here _create_assertion. Unlike BadgeClasses, An assertion is first created for Badgr so if something goes wrong, then it is not created for the LMS.
Where can I see/share my badge?
Ok⦠I got a badge. Great. How do I show off now?.
-
Go to Profile (make sure you do not have a limited profile, adding an age >21 is enough) and click on the accomplishments tab. You should see something like this.
-
Create an account in Badgr with the user email. Badgr does the association and once you register and enter, you will see something like this in your Backpack:
Issues:
- Certificate preview fails
Description: Certificate preview fails in Studio once OPENBADGES is enabled.
Reason: When previewing the certificate, a BadgeClass is created for audit mode and if there is no default CourseCompleteImageConfiguration, then the image_for_node method fails as query fails finding a default.
Quick fix: Define a default CourseCompleteImageConfiguration, then once you preview the Certificate a new BadgeClass will be created, in my case:
Appropriate Fix: I think that a badge class shouldnβt be created for audit mode while previewing the certificate trough studio.
- Assertions for Course Event Badges are not created.
Description: Student are not being awarded with Course Event Badges as the API request is failing.
Reason: Badgr server requires the Evidence which is not been provided. For course completion, this is the URL to the certificate which has public access.
Fix: WIP (According to the OpenBadges specification, the evidence field could receive multiple values, so it shouldnβt be a problem to pass the URLs of all certificates related to the badge)
- Badges are associated to email used in OpenEdx account.
Description: More than an issue, this is a warning. Once a user is awarded with a Badge, the Assertion/Award is created in Badgr with the email used by the user in the LMS. Therefore, if user is expecting to use another email to keep his/her Badges, then user should be aware of this.
Reason: This is the default behavior.
Fix: Create an account in Badgr to get your Badge and its public URL, with this URL you will be able to create a Badge in another account or Badging platform. The image can be downloaded from the LMS (Profile β Accomplishments)