How to implement Open edX Tutor badges

Hello I want use badges in my openedx tutor installation. I saw the docu but I don’t understand, How to fill this parametres.

  1. In the lms.yml and studio.yml files, in the FEATURES section, set the value of ENABLE_OPENBADGES to True .

Enable OpenBadge support. ‘ENABLE_OPENBADGES’: True,

  1. In lms.yml , set the values for the following parameters.
  • BADGR_USERNAME : The username connected to your Issuer App in Badgr.org or in your installation of Badgr Server. This will be used to create OAuth2 tokens.
  • BADGR_PASSWORD : The password connected to your Issuer App in Badgr.org or in your installation of Badgr Server. This will be used to create OAuth2 tokens.
  • BADGR_TOKENS_CACHE_KEY : The cache key for Badgr API tokens. Once created, the tokens will be stored in cache and can be retrieved using this key.
  • BADGR_BASE_URL : A string containing the base URL for Badgr Server. If you are running your own installation, the Badgr Server must be installed at a publicly accessible IP address. If you have registered an Issuer App with Badgr.org, this will be provided for you.
  • BADGR_ISSUER_SLUG : A string that is the slug for the Badgr issuer. The slug can be obtained from the URL of the Badgr Server page that displays the issuer. For example, in the URL http://exampleserver.com/issuer/test-issuer , the issuer slug is test-issuer .

How obtain BADGR_TOKENS_CACHE_KEY, BADGR_BASE_URL, BADGR_ISSUER_SLUG?, if I registered in Connected App Developers.

Hi @Ekwy_sobado!

BADGR_TOKENS_CACHE_KEY you make up or generate yourself.
BADGR_BASE_URL and BADGR_ISSUER_SLUG values depend on your configurations in the Badgr site.
For example, if you are starting with their test api, your BADGR_BASE_URL should be https://api.test.badgr.com. For the issuer slug go to https://test.badgr.com/issuers, select an issuer by clicking view issuer and then from the drop-down on the right, select view public page. You’ll find your BADGR_ISSUER_SLUG value in the url as in: https://test.badgr.com/public/issuers/<badgr_issuer_slug>/badges.

Hope this helps :slight_smile:

1 Like

I do not understand how to make up or generate the token. In my case I need the API from the webpage www.badger.org because I do not have the Badger Server installed.

So, the BADGR_TOKENS_CACHE_KEY is not a token itself, it is a key for storing the tokens (which are created and refreshed in the background for you) in cache, any random string value is fine for this.
If you registered an issuer app in https://badgr.org your BADGR_BASE_URL should be https://api.badgr.io (API Documentation)

1 Like

As for adding those settings to your Tutor-deployed Open edX platform: you will have to create a small Tutor plugin (a simple yaml file should be sufficient).

Hi Maari: two more things: it does not show in advance configuration the option of Issue Open Badges and in my profile I do not have an accomplisment window. How can I make them appear?

Hi @Ekwy_sobado sorry for the long wait, I am back from taking some vacation days now. I actually hadn’t tried to configure Badgr in Tutor previously. I did try that today though (in Tutor devstack) and here is what I found out.

The configuration options we discussed above here were added to master in #27181 but those changes are not in Lilac yet so unfortunately badging with Badgr backend is actually still broken in lilac.1. I am trying to get the fix to Lilac as well: Badgr integration updates Lilac (#27181) by mrtmm · Pull Request #28216 · edx/edx-platform · GitHub.
Since Tutor is running with open-release/lilac.1 you’d need to cherry-pick those changes for the time being.
To add the configuration settings, I created a Tutor plugin (a yaml file) as suggested by @regis and it looks like this:

name: badgr
version: 0.1.0
patches:
  openedx-common-settings: |
    BADGR_BASE_URL = ""
    BADGR_ISSUER_SLUG = ""
    BADGR_USERNAME = ""
    BADGR_PASSWORD = ""
    BADGR_TOKENS_CACHE_KEY = ""
  common-env-features: |
    "ENABLE_OPENBADGES" : true

This worked for me in my Tutor devstack, I hope this is useful.

1 Like