oauth2 Google Drive converter stopped converting files in the Moodle 3.3.7 AnnotatePDF function

Re: oauth2 Google Drive converter stopped converting files in the Moodle 3.3.7 AnnotatePDF function

by Ken Task -
Number of replies: 2
Picture of Particularly helpful Moodlers

and a follow up ...

https://docs.moodle.org/38/en/Google_Drive_converter

https://docs.moodle.org/38/en/OAuth_2_Google_service

and the section on app verification ...

where one sets up credentials
privacy policy url and terms of service url

Those pages I'd suggest making statically if your entity
doesn't already have them.

Google, like every service provider like them, ups the bar from time to time and really doesn't notify users (at least I've not found something to subscribe to that does).

Also, when users first access google via your Moodle they will or should be prompted with a permissions screen where the service account set up for this is given access to files ... wish they phrased that differently ... might warn users service account cannot be used to hack their stuff/edit files/upload files, etc.  Service account is sort of a 'pass through' and exist so there is some accountabiliy.

If your entity has also a Google for Schools domain might x-check about things in there admin of that might have to allow all users to do, etc.

'SoS', Ken


In reply to Ken Task

Re: oauth2 Google Drive converter stopped converting files in the Moodle 3.3.7 AnnotatePDF function

by Matthew Willis -
Hi Ken,

Thanks for responding to my issue, but I'm afraid none of your suggestions worked! sad

I'll respond to both of your comments here to keep the responses concise.
-------------------------------------------------------------------------------------
Scopes show openid profile email

**** Add to those the following URL: https://www.googleapis.com/auth/drive

and the only way I have been able to get it to work with doc conversions is to have a system account.

Even if you are not using Google Authentication.

And path to ghostscript OK? Have you tested conversion of a .doc or whatever to .pdf using ghostscript from command line?

https://www.ghostscript.com/doc/current/Use.htm
-------------------------------------------------------------------------------------

The other Google Cloud Platform accounts do not have "https://www.googleapis.com/auth/drive" added to the list of "Scopes for Google APIs" on the "Oauth Consent Screen", they only have the default "Email", "Profile", and "OpenID" attributes and their relevant Moodle LMSs do not have issues with converting non-PDF files to PDF via the AnnotatePDF function, so I fail to understand why I need to add this scope to fix this issue.

I have connected a system account to the Google OAuth 2 services within the Moodle platform (as per the first screenshot in my OP with the connected system account's details redacted for privacy reasons. This was done in accordance with the two Moodle Docs you mentioned at the time the Google integration was set up (ages before I created the OP).

Ghostscript works and the path is valid. However, we do not want to use Ghostscript due to its glaringly horrendous performance while under stress (our Moodle platform uses the AnnotatePDF function frequently, and we noticed that Ghostscript was not able to keep up the pace to suit demand). Path to Ghostscript is irrelevant, as the whole point of using Google's API is to use Google Drive converter as an alternative to the Ghostscript service.
-------------------------------------------------------------------------------------
and a follow up ...

https://docs.moodle.org/38/en/Google_Drive_converter

https://docs.moodle.org/38/en/OAuth_2_Google_service

and the section on app verification ...

where one sets up credentials
privacy policy url and terms of service url

Those pages I'd suggest making statically if your entity
doesn't already have them.

Google, like every service provider like them, ups the bar from time to time and really doesn't notify users (at least I've not found something to subscribe to that does).

Also, when users first access google via your Moodle they will or should be prompted with a permissions screen where the service account set up for this is given access to files ... wish they phrased that differently ... might warn users service account cannot be used to hack their stuff/edit files/upload files, etc. Service account is sort of a 'pass through' and exist so there is some accountabiliy.

If your entity has also a Google for Schools domain might x-check about things in there admin of that might have to allow all users to do, etc.
-------------------------------------------------------------------------------------

I have followed the Google Drive converter and Google Oauth 2 setup as per the articles you refer to when setting up this account and other accounts (I am very familiar with them, especially over the last few months), but the issue still persists in this single Moodle LMS, despite even moving it to another Google Cloud Platform account that manages other Moodle LMSs of a similar version (all v3 and higher), and it continues to be the only Moodle LMS that experiences this issue converting files to PDF.

We don't have any privacy policy or ToS URLs configured, as the articles you mentioned does not require it. We do not have these configured in any other Google Cloud Platform account, so they are also not needed here. Therefore, the issue is not with my Google Cloud Platform configurations, but with the Moodle LMS itself, thus my delve into the PHP errors in my last post.

I have looked at the problematic account today for the first time since Christmas, and I have noticed it was called successfully 44 times, but I continue to experience the same non-converting issue mentioned in my OP, both with existing assignment submissions (test ones dating back to September 2019) and test attempts conducted today.
In reply to Matthew Willis

Re: oauth2 Google Drive converter stopped converting files in the Moodle 3.3.7 AnnotatePDF function

by Ken Task -
Picture of Particularly helpful Moodlers

Your initial posting in this thread looks like errors that unoconv document conversion is throwing now with 3.5.10+

https://moodle.org/mod/forum/discuss.php?d=396281#p1597707

If you were to rename the downoaded 'document.pdf' to 'document.html' ... does the .html refer back to your site showing moodle front page without css formatting and showing not logged on?


In this posting the .docx and .pdf files attached
Didn't think the test actually converted any .docx, just shows what a converted PDF would look like.

do not want to use Ghostscript
Didn't think one could Annotate without it!

3.3.7 AnnotatePDF
Highest version of 3.3 is 3.3.9+.

Google Cloud Platform accounts
Confused .... did you move the entire sites to Google Cloud hosting  or does this refer to the Google accounts used with systems still on Windows?  Am thinking the latter.

In the Google Account you are configuring in Moodle ... API API's & Services
OAuth consent screen.

What does that look like?  OAuth rate limits?

https://docs.moodle.org/37/en/Google_Drive_converter
https://docs.moodle.org/35/en/Assignment_settings
File submissions
 (Check with your admin that Ghostscript and a document converter are enabled, if you can't annotate uploaded files.)

Feedback types
Annotate PDF appears if this setting is enabled by the Site administrator in the Manage assignment feedback plugins section of Site admin and will allow the teacher to annotate using comments,stamps and other features.

?????

'SoS', Ken