Can we pass a user's api-token as custom-parameter in an lti-launch

Can we pass a user's api-token as custom-parameter in an lti-launch

di Frode Halvorsen -
Numero di risposte: 2

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.

Media dei voti:  -
In riposta a Frode Halvorsen

Re: Can we pass a user's api-token as custom-parameter in an lti-launch

di Jake Dallimore -
Immagine Core developers Immagine Moodle HQ Immagine Peer reviewers Immagine Plugin developers Immagine Testers
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.
In riposta a Jake Dallimore

Svar: Re: Can we pass a user's api-token as custom-parameter in an lti-launch

di 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.