D2L Credential Harvester
This tool is intended to assist in gathering user credentials for building server / user-less automated API calls to D2L's Brightspace API.
Why?
Usually when you're creating an "app" in D2L, the intent is to have users access the app iteractively using their user credentials.
This pattern usually goes as follows:
- User goes to your "app"
- They are prompted to authenticate to D2L
- They log in and accept the permissions
- They can now use your apps and only access their own data through it
This is less useful in an automated situation -- we don't have a "user" to be doing actions. Instead, you should create a service account with access to relevant information for your purposes, and log them in via this page to grab the credentials necessesary to do automated stuff.
What you will need
- An app in D2L, with an app id and an app key
- A service account with authorization to access the desired data
Start with your service account. Contact IST to create a generic account, and in the ticket let them know the account will need to authenticate / log in to LEARN.
Once you have your service account, reach out to the LEARN team to create your app in D2L. When submitting this request, include the following:
- The "name" of your app (i.e. Science Data Analysis)
- The purpose of the app
- The callback url (must be exactly https://d2l-api-cred.fast.uwaterloo.ca no trailing slashes!)
- The service account's watiam ID (eg. scidata)
- What the account / app needs access to (eg. read access to all science grades)
With all this done, you should have an app id, an app key and a service account that you can log in with.
Credential Harvester
Results will appear here after logged in
What do I do with this?
You can use the resulting user id and user key to make queries against the Brightspace API, which will let you access any data that your user account has access to, and is enabled on the app settings for your app.
We provide a simple python library for connecting to the data:
- learn_api.py is a python module you can import and use in your projects, you will need to wire up the credentials provided.