Skip to content

Commit dfc665c

Browse files
committed
Make the registration_token parameter in the registration response from the LMS optional.
According to the specification it is optional, and apparently D2L does not send it. Both Moodle and Canvas do.
1 parent 400f812 commit dfc665c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

lib/WeBWorK/ContentGenerator/LTIAdvantage.pm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ sub purge_expired_lti_data ($c, $ce, $db) {
444444

445445
async sub registration ($c) {
446446
return $c->render(json => { error => 'invalid configuration request' }, status => 400)
447-
unless defined $c->req->param('openid_configuration') && defined $c->req->param('registration_token');
447+
unless defined $c->req->param('openid_configuration');
448448

449449
# If we want to allow options in the configuration such as whether grade passback is enabled or to allow the LMS
450450
# administrator to choose a tool name, then this should render a form that the LMS will be presented in an iframe
@@ -478,7 +478,9 @@ async sub registration ($c) {
478478
my $registrationResult = (await Mojo::UserAgent->new->post_p(
479479
$lmsConfiguration->{registration_endpoint},
480480
{
481-
Authorization => 'Bearer ' . $c->req->param('registration_token'),
481+
defined $c->req->param('registration_token')
482+
? (Authorization => 'Bearer ' . $c->req->param('registration_token'))
483+
: (),
482484
'Content-Type' => 'application/json'
483485
},
484486
json => {

0 commit comments

Comments
 (0)