不通过javascript中的api登录访问驱动器文件(web应用程序)

不通过javascript中的api登录访问驱动器文件(web应用程序),javascript,oauth-2.0,google-drive-api,google-spreadsheet-api,google-authentication,Javascript,Oauth 2.0,Google Drive Api,Google Spreadsheet Api,Google Authentication,我将javascript与drive+电子表格api一起使用。现在我可以获得访问令牌了。但我尝试了很多与堆栈的答案和谷歌指南获取刷新令牌请求。但是我没有找到一种方法来逐个访问刷新令牌。请帮我写一些代码 我的剧本是: var _url = https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/us

我将javascript与drive+电子表格api一起使用。现在我可以获得访问令牌了。但我尝试了很多与堆栈的答案和谷歌指南获取刷新令牌请求。但是我没有找到一种方法来逐个访问刷新令牌。请帮我写一些代码

我的剧本是:

var _url = https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email&client_id={my_client_id}&client_secret={My_secret_key}","redirect_uri=httpmypath to currentrunningfile/oauth&response_type=token

function getAccessDetails() {
        var win         =   window.open(_url, "windowname1", 'width=800, height=600'); 

        var pollTimer   =   window.setInterval(function() { 
            try {
                console.log(win.document.URL);
                if (win.document.URL.indexOf(REDIRECT) != -1) {
                    window.clearInterval(pollTimer);
                    var url =   win.document.URL;
                    console.log('url is :'+url);
                    acToken =   gup(url, 'access_token');
                    tokenType = gup(url, 'token_type');
                    expiresIn = gup(url, 'expires_in');
                    console.log('acToken :' + acToken + 'tokenType :' + tokenType + 'expiresIn :' + expiresIn);
                    win.close();

                    validateToken(acToken);
                }
            } catch(e) {
            }
        }, 500);
    }

下一步是什么以及如何对其进行编码以访问刷新令牌?事实上,我希望用户第一次登录到应用程序与他们的谷歌登录详细信息为他们的驱动器文件访问我的应用程序。下次用户使用我的应用程序访问其驱动器文件时。他无需登录即可访问文件。

我获得了刷新令牌。只需使用代码向google服务器发出HTTP请求并访问\u type=offline即可。现在我只想知道用户如何在每次都不登录的情况下访问我的应用程序。您可能需要检查,此示例应用程序显示了您希望在应用程序中实现的目标。如果您使用的是JavaScript客户端库,它将自动验证Google授权服务器返回的访问令牌。有关更多信息,请参阅。希望这有帮助。您好。。。你找到解决办法了吗?