我在尝试执行代码时在控制台中遇到以下错误:
POST https://content.googleapis.com/urlshortener/v1/url?alt=json&key=AIzaSyB3BGJskI7cJUvnl7jzjiX4eh86K9sldgA 403 (Forbidden)
我正在使用谷歌URL Shortner API,并认为该问题源于权限不足,如错误详细所示:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "insufficientPermissions",
"message": "Insufficient Permission"
}
],
"code": 403,
"message": "Insufficient Permission"
}
}
以下是我认为影响它的代码部分:
/ The Browser API key obtained from the Google Developers Console.
var developerKey = 'ID';
// The Client ID obtained from the Google Developers Console.
var clientId = 'ID';
// Scope to use to access user's photos.
var scope = ['https://www.googleapis.com/auth/drive'];
var pickerApiLoaded = false;
var oauthToken;
// Use the API Loader script to load google.picker and gapi.auth.
function onApiLoad() {
gapi.load('auth', {'callback': onAuthApiLoad});
gapi.load('picker', {'callback': onPickerApiLoad});
}
function onAuthApiLoad() {
window.gapi.auth.authorize(
{
'client_id': clientId,
'scope': scope,
'immediate': true
},
handleAuthResult);
}
特别是
'范围':范围,
我一直在努力解决这个问题,并且正在寻找一个解决方案。