Implement Google Calendar API I got redirect_uri_mismatch er

sergeynilov posted 1 week ago

Hello, I have laravel 5.8 app installed on ubuntu 18( under Digital Ocean ) under domain:

I try to implement Google Calendar API in my app and I have control :



namespace App\Http\Controllers;

use Carbon\Carbon;
use Google_Client;
use Google_Service_Calendar;
use Google_Service_Calendar_Event;
use Google_Service_Calendar_EventDateTime;
use Illuminate\Http\Request;

class gCalendarController extends Controller
    protected $client;

    public function __construct()
        $client = new Google_Client();

        $guzzleClient = new \GuzzleHttp\Client(array('curl' => array(CURLOPT_SSL_VERIFYPEER => false)));
        $this->client = $client;

     * Display a listing of the resource.
     * @return \Illuminate\Http\Response
    public function index()
        if (isset($_SESSION['access_token']) && $_SESSION['access_token']) {
            $service = new Google_Service_Calendar($this->client);

            $calendarId = 'primary';

            $results = $service->events->listEvents($calendarId);
            return $results->getItems();

        } else {
            return redirect()->route('oauthCallback');


with routes :

Route::resource('gcalendar', 'gCalendarController');
Route::get('oauth', ['as' => 'oauthCallback', 'uses' => '[email protected]']);

running index method with url I got redirect error :

400. That’s an error.

Error: redirect_uri_mismatch

Request Details
That’s all we know.

My app options are : All options with

Why redirect error and how to fix it ?


sergeynilov replied 1 week ago

I have just payed attention that

  1. my application home Link had “/” at end. Could it be the issue? I fixed it but still having problems.

  2. When in Authorized Domains I edit “” I see that “” is entered in Authorized Domains : Can it be the issue? How can it be salved, as "" is hosting (made in of my app (located on ubuntu 18 under Digital ocean ).

Sign in to participate in this thread!

We'd like to thank these amazing companies for supporting us