2014-03-31 88 views
0

我想進行插入授權請求。據API Explorer我需要以下範圍:請求的作用域不允許:admin.directory.group.member

​​

在代碼中它是這樣的:

{ 
    ... 
    , scopes": [ 
     "https://www.googleapis.com/auth/admin.directory.group" 
     , "https://www.googleapis.com/auth/admin.directory.group.member" 
    ] 
} 

我有一個pem文件的JWT身份驗證使用。讓我們來看看代碼:

// dependencies 
var Assert = require('assert') 
    , GoogleApis = require('googleapis') 
    , authData = require("./authData") 
    ; 

// output 
console.log("Auth data is: ", authData); 

// set jwt data 
var jwt = new GoogleApis.auth.JWT(
    authData.email 
    , authData.keyFile 
    , authData.key 
    , authData.scopes // my scopes 
    , "[email protected]" 
); 

// authorize 
jwt.authorize(function (err, data) { 

    // output error 
    if (err) { 
     console.log("Error: ", err); 
     return; 
    } 

    /* run authorized requests */ 
}); 

我得到以下錯誤:

{ 
    error: 'access_denied', 
    error_description: 'Requested scopes not allowed: https://www.googleapis.com/auth/admin.directory.group https://www.googleapis.com/auth/admin.directory.group.member' 
} 

爲什麼會出現這個錯誤?

回答