Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9001335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:25:22+00:00 2026-06-16T00:25:22+00:00

How do I request access to a user’s calendar once , then query events

  • 0

How do I request access to a user’s calendar once, then query events without having to request access again? Is there an access key that can grant continuous access as long as it isn’t revoked?

I am currently using the google-calendar module in a nodejs app running express + mongodb.

The example below shows partial code for making the OAuth request and redirecting back to the app. This works great. What I want though is once I have access, to be able to query the user’s events any time I want. This will be used in a booking app which, once a user registers their public Google Calendar, allows others to see their availability.

I have looked at the Google Calendar API documentation, but I can’t figure out what is needed for the ongoing access I need.

Configuration:

var GoogleCalendar = require('google-calendar');
var google_calendar = new GoogleCalendar.GoogleCalendar(config.google.clientId, config.google.clientSecret, 'http://localhost:3000/authentication');

Display route:

app.get('/display', function(req, res) {

    // redirect user to Google Authentication
    var access_token = req.session.access_token;
    if(!access_token) {
            req.session.authReturn = req.url;
            return res.redirect('/authentication');
    }

    google_calendar.listCalendarList(access_token, function(err, calendarList) {
            // do something with the calendar events...
    }

    ...

Authenticate route:

app.all('/authentication', function(req, res){

    // Redirect the user to Google's authentication form 
    if(!req.query.code){

        google_calendar.getGoogleAuthorizeTokenURL(function(err, redirectUrl) {
            if(err) return res.send(500,err);
            return res.redirect(redirectUrl);
        });
    }
    // Get access_token from the code
    else {
        google_calendar.getGoogleAccessToken(req.query, function(err, access_token, refresh_token) {

            if(err) return res.send(500,err);

            req.session.access_token = access_token;
            req.session.refresh_token = refresh_token;

            return res.redirect(req.session.authReturn);
        });
    }
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:25:22+00:00Added an answer on June 16, 2026 at 12:25 am

    Use the Oauth 2.0 offline access parameter. See details at:

    https://developers.google.com/accounts/docs/OAuth2WebServer#offline

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a getCurrentUser method in Spring to access the user that is currently
Is there a way to access the http request IE made when the page
I would like to make an ajax request that still retains access to the
When using AccountManager::getAuthTokenByFeatures , an Access Request screen is shown for the user to
I know I can make a html get request to access a user's basic
I created a test app on Facebook. I chose to request access to user
I'm trying to access the request.user object when testing my app using django's client
Each request in my web app can get one data access object instance (of
How can I access raw body of request object given to me by expressjs?
I am trying to access the parameters passed in my AJAX request, but when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.