1

据我所知,在 IE 中使用 Javascript 中的 Drive API 进行 OAuth 身份验证是不可能的。采取可以想象的最简单的身份验证代码:

<html>
  <head>
    <script src="https://apis.google.com/js/client.js"></script>
    <script>
      function auth() {
        var config = {
          'client_id': 'YOUR CLIENT ID',
          'scope': 'https://www.googleapis.com/auth/urlshortener'
        };
        gapi.auth.authorize(config, function() {
          console.log('login complete');
          console.log(gapi.auth.getToken());
        });
      }
    </script>
    <script type="text/javascript" src="https://apis.google.com/js/client.js"></script>
  </head>

  <body>
    <button onclick="auth();">Authorize</button>
  </body>
</html> 

如果您提供自己的客户端 ID,这将在 IE 中工作。现在将“范围”变量更改为“ https://www.googleapis.com/auth/drive ”。如果您尝试在 IE 中对此进行测试,您应该会看到 JS 库将被炸毁并无法进行身份验证。

4

1 回答 1

0

您是否在 api 控制台中启用了 Drive SDK/API?

转到 Google API 控制台 -> 服务 -> 并打开 Drive SDK 和 Drive API。

这就是为什么驱动 sdk 范围不起作用而urlshorter的得分起作用的原因之一。

于 2013-08-12T12:32:26.893 回答