We are developing a module that requires the use of the Rest-api's in Moodle, but we really don't want to store any user-credentials in our system, as the user is passed in via a regular LtiResourceLinkRequest-launch. So passing a fresh token in this laucnh will enable us to call the rest-api's in Moodle using the current user's token rather than calling a new login at Moodle.
Can we pass a user's api-token as custom-parameter in an lti-launch
by Frode Halvorsen -
Number of replies: 2
In reply to Frode Halvorsen
Re: Can we pass a user's api-token as custom-parameter in an lti-launch
by Jake Dallimore -
Hi Frode,
Unfortunately, not right now. You can see the substitution params list here: https://github.com/snake/moodle/blob/777d00ef37e8588a2ba74cea302e9553c2f0e85d/mod/lti/locallib.php#L3868
We definitely need to consider how we want to achieve this kind of thing in future though. I recall a few similar requests in the past.
Unfortunately, not right now. You can see the substitution params list here: https://github.com/snake/moodle/blob/777d00ef37e8588a2ba74cea302e9553c2f0e85d/mod/lti/locallib.php#L3868
We definitely need to consider how we want to achieve this kind of thing in future though. I recall a few similar requests in the past.
In reply to Jake Dallimore
Svar: Re: Can we pass a user's api-token as custom-parameter in an lti-launch
by Frode Halvorsen -
Ok - is there any url that can be used for a logged in user to get an api-token ? Because if there is, we can use that instead, since the user doing the lti-launch has a valid UI-session in Moodle, than then can be used to obtain the token.