Google drive api Javascript OAuth在IE for Google Drive中不工作吗?
据我所知,在IE中使用Javascript中的驱动API进行OAuth身份验证是不可能的。请使用可以想象得到的最简单的身份验证代码:Google drive api Javascript OAuth在IE for Google Drive中不工作吗?,google-drive-api,Google Drive Api,据我所知,在IE中使用Javascript中的驱动API进行OAuth身份验证是不可能的。请使用可以想象得到的最简单的身份验证代码: <html> <head> <script src="https://apis.google.com/js/client.js"></script> <script> function auth() { var config = { 'c
<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>
函数auth(){
变量配置={
“客户id”:“您的客户id”,
'范围':'https://www.googleapis.com/auth/urlshortener'
};
gapi.auth.authorize(配置,函数(){
log('login complete');
log(gapi.auth.getToken());
});
}
授权
如果您提供自己的客户端ID,这将在IE中起作用。现在将“scope”变量更改为“”。如果您尝试在IE中进行测试,您应该会看到JS库将爆炸并无法进行身份验证。您是否在API控制台中启用了驱动器SDK/API 转到Google API控制台->服务->并打开驱动器SDK和驱动器API
这就是为什么drive sdk scope在score for works时不起作用的原因之一。是的,我已经这样做了,我应该补充一点,我已经在Google Chrome中使用了这个示例。