小编Mic*_*iel的帖子

谷歌身份验证:OAuth2不断返回'invalid_grant'

我开始在我的新应用程序上配置谷歌日历.我几乎完成了Google开发人员显示的身份验证代码的完整副本(https://developers.google.com/google-apps/calendar/instantiate),但我不断收到以下错误:

获取OAuth2访问令牌时出错,消息:'invalid_grant'

我目前正在使用Fork-CMS(http://www.fork-cms.com),一个年轻的lightweigth CMS.我正确配置了google-api-php-client的config.php文件.(客户端ID,客户端密码,redirect-uri,开发密钥,...)和重定向uri在google api的控制台上正确设置.我的代码如下:

<?php

/**
* This is a widget with a calendar implementation.
*
* @package       frontend
* @subpackage    events
*
* @author        Michiel Vlaminck <michielvlaminck@gmail.com>
*/
class FrontendEventsWidgetCalendar extends FrontendBaseWidget
{

    private $events = array();
    private $authUrl = array();

    /**
    * Execute the extra
    *
    * @return    void
    */
    public function execute()
    {      
        // call parent
        parent::execute();

        // load template
        $this->loadTemplate();

        // get data
        $this->getData();

        // parse
        $this->parse();
    }


    /**
    * Get …
Run Code Online (Sandbox Code Playgroud)

php google-calendar-api oauth-2.0

19
推荐指数
3
解决办法
4万
查看次数

标签 统计

google-calendar-api ×1

oauth-2.0 ×1

php ×1