Moodle for mobile

Missing token for file downloads

 
Picture of Acs Gabor
Missing token for file downloads
 

Dear All,

We are having a problem with the app since our last upgrade (3.5.1), it does not open any files from the app ("open the file"), just some small corrupt files are downloaded. We tried with the newest version of the app and with the classic version as well.

All other functions work fine, login, activites, file upload, and even file downloads with the "open in browser" menu.

We tested from Android and and Ipad, both failed, but both worked with the demo.moodle.net site.

I checked all admin settings in Moodle and everything looks fine (the same as on the demo page)

This is the error message we get:

{"error":"A required parameter (token) was missing","errorcode":"missingparam","stacktrace":null,"debuginfo":null,"reproductionlink":null}

Log: [Tue Sep 11 09:39:53.107368 2018] [proxy_fcgi:error] [pid 23614:tid 139732566619904] [client 10.10.10.62:53120] AH01071: Got error 'PHP message: Default exception handler: A required parameter (token) was missing Debug: \nError code: missingparam\n* line 482 of /lib/setuplib.php: moodle_exception thrown\n* line 573 of /lib/moodlelib.php: call to print_error()\n* line 45 of

/webservice/pluginfile.php: call to required_param()\n\n'

I tried to debug further with the https://mobileapp.moodledemo.net/ page, and the only thing I noticed is that the token.php file is not loaded at all.

Do you have any suggestions what should we look into?

Thanks in advance!

 
Average of ratings: -
Picture of Dani Palou
Re: Missing token for file downloads
Core developersMoodle HQParticularly helpful MoodlersPlugin developers

Hi,

how are you adding the files to download?

Usually files added in Moodle point to the file pluginfile.php, and then the app modifies those URLs to use the file webservice/pluginfile.php and it adds the user token. It seems your script isn't receiving the token, maybe the params are lost due to some Apache configuration?

Kind regards,

Dani

 
Average of ratings: -
Picture of Acs Gabor
Re: Missing token for file downloads
 

Dear Dani,

Thanks very much, it was an Apache config issue indeed.

The problem was with a Rewriterule - we had to add the [QSA] flag to make it work.

Best regards,

Gabor

 
Average of ratings: -