Skip to content

Commit

Permalink
release(5.9.5): Dynamic registration improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvmcosta committed May 1, 2024
1 parent d95ab04 commit dfa3a2f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
7 changes: 7 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@

### CHANGELOG

#### V5.9.5
> 2024-05-01
> - A few improvements to dynamic registration.
> - Fixed the regular LTI launch message type. This was not causing any issues, as the regular launch is always implied when performing dynamic registration.
> - Added ability to modify dynamic registration options when creating a custom handler. Thank you @pfgray for the contribution!

#### V5.9.4
> 2024-04-10
> - Updated dependencies.
Expand Down
27 changes: 27 additions & 0 deletions docs/dynamicregistration.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ The registration can be finalized by calling the `lti.DynamicRegistration.regist

The following example is a representation of the default Dynamic Registration flow:


```javascript
lti.onDynamicRegistration(async (req, res, next) => {
try {
Expand All @@ -138,6 +139,32 @@ lti.onDynamicRegistration(async (req, res, next) => {
```


You can also pass a third parameter to `lti.DynamicRegistration.register` containing overrides for the default dynamic registration options.

The following example is a representation of the default Dynamic Registration flow with added custom parameters:


```javascript
lti.onDynamicRegistration(async (req, res, next) => {
try {
if (!req.query.openid_configuration) return res.status(400).send({ status: 400, error: 'Bad Request', details: { message: 'Missing parameter: "openid_configuration".' } })
const message = await lti.DynamicRegistration.register(req.query.openid_configuration, req.query.registration_token, {
'https://purl.imsglobal.org/spec/lti-tool-configuration': {
custom_parameters: {
'custom1': 'value1',
'custom2': 'value2'
}
}
})
res.setHeader('Content-type', 'text/html')
res.send(message)
} catch (err) {
if (err.message === 'PLATFORM_ALREADY_REGISTERED') return res.status(403).send({ status: 403, error: 'Forbidden', details: { message: 'Platform already registered.' } })
return res.status(500).send({ status: 500, error: 'Internal Server Error', details: { message: err.message } })
}
})
```

### Moodle LMS

Follow the steps bellow to use the Dynamic Registration Service with the Moodle LMS:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ltijs",
"version": "5.9.4",
"version": "5.9.5",
"description": "Easily turn your web application into a LTI 1.3 Learning Tool.",
"main": "index.js",
"engineStrict": true,
Expand Down

0 comments on commit dfa3a2f

Please sign in to comment.