Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/402.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 为什么谷歌API(目录列表)一直返回403?有进化吗?新版本?GPDR/LGPD问题?_Javascript_Google Api Client_Google Admin Sdk - Fatal编程技术网

Javascript 为什么谷歌API(目录列表)一直返回403?有进化吗?新版本?GPDR/LGPD问题?

Javascript 为什么谷歌API(目录列表)一直返回403?有进化吗?新版本?GPDR/LGPD问题?,javascript,google-api-client,google-admin-sdk,Javascript,Google Api Client,Google Admin Sdk,我有一个应用程序由于用户列表()不断返回而突然停止工作: { "error": { "code": 403, "message": "Not Authorized to access this resource/api", "errors": [ { "message": "Not Authorized to a

我有一个应用程序由于用户列表()不断返回而突然停止工作:

{
  "error": {
    "code": 403,
    "message": "Not Authorized to access this resource/api",
    "errors": [
      {
        "message": "Not Authorized to access this resource/api",
        "domain": "global",
        "reason": "forbidden"
      }
    ]
  }
}
此应用程序提供给两个不同的域。它对一方正常工作,但对另一方无效。相同的代码。。。只需更改appId、apiKey和clientId。我使用作用域(,)配置了广域委派,还配置了API密钥OAuth 2.0客户端

我尝试重新创建整个项目,所有凭据,尝试http和https。。。同样的错误

API规范中是否有更改?我错过了什么

已编辑-请求的源代码:

我只是复制了整个代码,用凭据更改了“设置”,并在浏览器控制台中执行。该代码在身份验证之前或之后工作,但具有403响应:-(

//这是我从https://github.com/lord22shark/google
(函数(_窗口){
const Google=函数(配置,\回调){
如果((!配置)| |!(对象的配置实例)){
抛出新错误('必须定义Google API包装-“配置!”);
}
if((!configuration.apiKey)| |!(typeof(configuration.apiKey)=='string')| |(configuration.apiKey===''){
抛出新错误('必须定义Google API包装器-“apiKey!”);
}
if((!configuration.discoveryDocs)| |!(configuration.discoveryDocs数组实例)| |(configuration.discoveryDocs.length==0)){
抛出新错误('Google API包装器-“discoveryDocs”必须是已定义的数组!');
}
if((!configuration.clientId)| |!(typeof(configuration.clientId)==“string”)| |(configuration.clientId==”){
抛出新错误('必须定义Google API包装-“clientId!”);
}
if((!configuration.scope)| |!(typeof(configuration.scope)=='string')| |(configuration.scope===''){
抛出新错误('Google API包装器-“范围”必须定义!');
}
常数thiz=这个;
/**
*
*/
this.element=document.createElement('script');
this.element.type='text/javascript';
this.element.async=true;
this.element.defer=true;
this.element.src=https://apis.google.com/js/api.js';
/**
*
*/
this.element.onload=函数(){
load('client:auth2',函数(){
gapi.client.init({
“apiKey”:configuration.apiKey,
“discoveryDocs”:配置。discoveryDocs,
“clientId”:configuration.clientId,
“范围”:configuration.scope
}).然后(函数(){
thiz.googleAuthInstance=gapi.auth2.getAuthInstance();
//侦听登录状态的更改。
//回调函数必须是全局命名函数
thiz.googleAuthInstance.isSignedIn.listen(onUpdateGoogleSignInStatus);
thiz.setSignnstatus();
}).catch(函数(错误){
__回调(错误);
});
}.绑定(thiz));
};
/**
*
*/
this.element.onreadystatechange=函数(){
如果(this.readyState==='complete'){
这个.onload();
}
};
/**
*
*/
this.setSignnstatus=函数(isSignedIn){
if((isSignedIn==真)| |(isSignedIn==未定义)){
this.user=this.googleAuthInstance.currentUser.get();
this.authorized=this.user.hasGrantedScopes(configuration.scope);
this.authorizationToken=(this.authorized)?this.user.getAuthResponse();
如果(!本.授权){
this.googleAuthInstance.signIn().then(函数(authenticatedUser){
__回调(this.user、this.authorized、this.authorizationToken、this.googleAuthInstance);
}.bind(this)).catch(函数(错误){
__回调(错误);
});
}否则{
__回调(this.user、this.authorized、this.authorizationToken、this.googleAuthInstance);
}
}
};
/**
*
*/
this.getAuthInstance=函数(){
返回this.googleAuthInstance | | null;
};
/**
*
*/
this.getUser=函数(){
返回this.user | | null;
};
/**
*
*/
this.getAuthorizationToken=函数(){
返回此.authorizationToken;
};
/**
*
*/
this.getConfiguration=函数(){
返回配置;
};
/**
*
*/
this.hasGrantedScopes=函数(){
返回此文件。已授权;
};
/**
*
*/
this.disconnect=函数(取消验证、回调){
if(this.googleAuthInstance.isSignedIn.get()){
if(反验证===真){
this.googleAuthInstance.disconnect().then(函数(){
if((回调函数)和&(回调函数的实例)){
回调(true);
}
});
}否则{
this.googleAuthInstance.signOut().then(函数(){
if((回调函数)和&(回调函数的实例)){
回调(假);
}
});
}
}
};
/**
*
*/
__window.onUpdateGoogleSignInStatus=函数onUpdateG