No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
server
src
.gitignore
CONTRIBUTING.md
LICENSE
README.md
bower.json
package.json
server-local.js
server.js

README.md

Awards Leaderboard

Overview

This repo represents a demo/sample solution to show what can be done with the Brightspace Awards APIs.

This solution makes use of the classlist awards route, /d2l/api/bas/1.0/orgunits/{orgUnitId}/classlist/, to enable the gathering of the users, their awards and their rankings. By using this route we are able to make as few REST calls as possible and get the most data back. This approach may not be the best fit depending on what type of application you are looking to create.

This solution uses Polymer and Brightspace UI components to create the UI.

Please note, this repo is not intended to be used in production.

Technology Used

  • node
  • Brightspace UI Components
  • Polymer Components
  • LTI
  • OAuth2.0
  • Brightspace APIs

Setup Instructions

Options for getting started:

Installation

Run the NPM installation command in the root folder of the project using the command line.

npm install

Run the Bower installation command in the root folder of the project using the command line.

bower install

Build the UI by running the following command in the root folder of the project using the command line. This will output an index.html file to the dist folder in the project root.

npm run build

At this point you are able to run the node server by running the node command on the server.js file.

node server.js

Note: if you are working with a local Brightspace instance you can run the following command that will use a self signed certificate so that you are able to use OAuth 2.0 successfully.

node server-local.js

Configurations

There are several configurations in this project that can be set at the environment level (using environment variables), that the app will use to conduct it's various authentication checks and execute successfully against the desired Brightspace instance. These configurations can also be overridden in the configurations.js file found under the server folder in this project.

  • AUTH_SCOPE - the scope required for the application in order to call the required Brightspace APIs, for the awards APIs the currently required scope is core:*:*
  • AUTH_ENDPOINT - the endpoint used for retrieving an authentication code that is exchanged in the callback for an access token - Setting Up OAuth 2.0 Authentication
  • CLIENT_ID - the client id for the OAuth client created in Brightspace
  • CLIENT_SECRET - the client secret for the OAuth client created in Brightspace
  • COOKIE_NAME - the name of the cookie where the UserId, OrgUnitId and the access token are stored for the user's session
  • INSTANCE_URL - the URL for the Brightspace instance where the calls to the APIs are going to be made
  • LTI_SECRET - the secret used when setting up the Learning Tool Provider in Brightspace, this is used to generate the signature in order to verify the request came from an authorized instance of Brightspace
  • STATE - the state is a pre-defined string (recommended to be a randomly generated guid) that is sent across in the OAuth authentication request and is sent back in the callback from Brightspace so that you can verify that the callback is coming from Brightspace
  • TOKEN_ENDPOINT - the endpoint used for exchanging the authentication code for an access token that is then used in API requests - Setting Up OAuth 2.0 Authentication
  • PORT - the port which the server will listen for requests on

SSL

In order for the OAuth 2.0 implementation to be able to authenticate and to be setup in Brightspace it requires an https endpoint. Therefore when this application is used it needs to be setup using a certificate and hosted in an environment where the https protocol is enabled.

External Links

Here is a listing of useful links about the Brightspace API, Awards API and the LTI technology used in this project.

Brightspace Info

Brightspace API

Brightspace UI Components

Versioning

Awards-Leaderboard is maintained under the Semantic Versioning guidelines.

Contributing

Please read through our contributing guidelines. Included are directions for opening issues, coding standards, and notes on development.