Support the ongoing development of →
Configuration Requests Validation
Last updated 1 year ago.

Not sure if I understand your question correctly.

You could actually avoid doing google auth all the time by setting access_type to offline in your Google API configuration. If I remember correctly, you have to enable it in Google console as well.

In that case you only need to do once, and you can save the access token it returns to your config file.

It's been awhile since I wrote it as a service provider, so hopefully I remember them correctly. Example code,

try {
    $google = new Google_Client($config); // remember to change $config['access_type'] = 'offline';
    $accessToken = Config::get('google.access_token'); // access token you saved earlier

    $cal = new Google_CalendarService($google);

    // Now you get do whatever you want in $cal
    // Please refer to this for more information
    // vendor /bitgandtter / google-api / src / contrib / Google_CalendarService.php

    // For example, you want to grab the list of calendars that person has. 
    // @return Google_CalendarList
    $calendarList = $cal->calendarList->listCalendarList();

catch (Google_ServiceException $e) {
    // Your action ...
catch (Google_AuthException $e) {
    // Your action ...

Hope it helps!


Last updated 1 year ago.

Thank you!

Last updated 1 year ago.

Sign in to participate in this thread!


Your banner here too?

sevmardi sevmardi Joined 19 Jun 2014


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

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.