Google Calendar API - (403)未配置访问权限'

Lur*_*k21 3 php google-calendar-api google-api

我开发了一个使用Google Calendar API的应用程序.

当我将其从开发环境移至测试环境时,我在Google API控制台中为其创建了新条目,并将该信息复制到config.php中.

// The application_name is included in the User-Agent HTTP header.
'application_name' => 'Google Calendar PHP Starter Application',

// OAuth2 Settings, you can get these keys at https://code.google.com/apis/console
'oauth2_client_id' => '517034425134-503uog3i6pfXk15qq6mjsfbi48sabd50o.apps.googleusercontent.com',
'oauth2_client_secret' => '4p4go-aRXVcGx4YxcgC2wgvyV',
'oauth2_redirect_uri' => 'http://mydomain/admin/calendar_events.php',

// The developer key, you get this at https://code.google.com/apis/console
'developer_key' => 'AIzaSyCm9tj17rd-OepTl5XFxMwI9SQMH2BoQkKI',
Run Code Online (Sandbox Code Playgroud)

但是,我没有访问权限.我正进入(状态:

Uncaught exception 'Google_ServiceException' with message 'Error calling GET https://www.googleapis.com/calendar/v3/users/me/calendarList?key=AIzaSyCm9tj17rd-OepTl5XFxMwI9SQMH2BoQkKI: (403) Access Not Configured'
Run Code Online (Sandbox Code Playgroud)

我不确定为什么会这样.我知道代码很好......我只需要在他们的API控制台和我的config.php之间进行同步,对吧?

有任何想法吗?

Lur*_*k21 5

我不得不评论这一行:

//'developer_key'=>'AIzaSyCm9tj17rd-OepTl5XFxMwI9SQMH2BoQkKI',

然后它奏效了.