Javascript 使用服务帐户从APEX实现Google驱动器访问

Javascript 使用服务帐户从APEX实现Google驱动器访问,javascript,google-drive-api,apex,Javascript,Google Drive Api,Apex,尝试在APEX上编写应用程序,通过服务帐户从Google Drive获取文件。在此处找到一些示例代码: 但这在Apex内部不起作用(使用代码创建一个文件,并通过共享组件0>静态文件上载到Apex。然后从代码调用它) 每次都有错误: gapi2.js:6 Uncaught TypeError: Cannot read property 'auth' of undefined at gapi2.js:6 Refused to execute script from 'https://ap

尝试在APEX上编写应用程序,通过服务帐户从Google Drive获取文件。在此处找到一些示例代码:

但这在Apex内部不起作用(使用代码创建一个文件,并通过共享组件0>静态文件上载到Apex。然后从代码调用它)

每次都有错误:

gapi2.js:6 Uncaught TypeError: Cannot read property 'auth' of undefined
    at gapi2.js:6

Refused to execute script from 'https://apex.oracle.com/pls/apex/f?p=4550:1:13365023955065:::::#APP_IMAGES#credentials.json.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
require.js:168 

Uncaught Error: Script error for "#APP_IMAGES#credentials.json"
https://requirejs.org/docs/errors.html#scripterror
    at makeError (require.js:168)
    at HTMLScriptElement.onScriptError (require.js:1738)


My file with code called gapi2.js
My JSON file with creds of service account called credentials.json
###################

另外,由于apex中不知道需要,因此下载的是代码,并通过共享组件从此处上载: (require.js 2.3.6)

而不是

const { google } = require('googleapis');
做过

因为GoogleAPI是一个npm库,APEX也不知道

任何帮助都将不胜感激

const { google } = require(['https://apis.google.com/js/api.js']);