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

  • Home
  • SEARCH
  • 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 7696325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:45:12+00:00 2026-05-31T21:45:12+00:00

Ok, so this question has been asked before here . In the response/answer to

  • 0

Ok, so this question has been asked before here. In the response/answer to the question, the user tells him to store the refresh_token in the application (session and not db, although it doesn’t matter where you store it). After going through the documentation on Google, it seems that the access_token has an expiration date after which it is no longer valid. Now, we could obviously automatically refresh the token every fixed interval or if the service returns an invalid token error, thereby prolonging the lifespan of the token, but for some reason, this manual process feels a bit hacky. My questions is:

  • Is this most effective (/generally accepted) way to access google calendar/app data for a known user account by manually logging in and persisting the token in the application? Or is there another mechanism that allows us to programmatically login to this user account and go through the OAuth steps?
  • 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-05-31T21:45:14+00:00Added an answer on May 31, 2026 at 9:45 pm

    In my application, the flow is like this:

    1. If no access_token defined, redirect the user to the Google page where they grant access to your application accessing their Google data. This returns an authorization code to your app.
    2. Use the authorization code to get an access_token and refresh_token. You should also save the expires_in value returned, which tells you when the access_token expires and can no longer be used.
    3. Whenever you need to access the API, you can check in your DB if the access_token is expired – if so, use the refresh_token to get a new access_token before accessing the API.

    I haven’t run in to any problems doing it this way – as far as the user is concerned, they only need to grant access once, then the app takes care of the authentication from there on.

    That should solve your problem, because the app programmatically keeps re-authenticating itself based on the user initially granting access to your app, and you don’t need to do anything manually. In fact, I’m not sure there’s any other way to do it, because to do the OAuth process again, the user has to be sitting in front of the device to manually grant access. That’s the point of persisting the access_token and refresh_token in your database.

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

Sidebar

Related Questions

This question has been asked here before . The accepted answer was probably obvious
I know this question has been asked here before, but I don't think those
This question has been asked in various forms on here before, but I cannot
This question has been asked here on SO before with below code find3missing(int* array)
This question has been asked here before, but the author wasn't very clear and
Folks, I know this question has been asked before here, though indirectly . But
This question has been asked before (see here and here , for example). However,
I apologise if this question has already been asked on here before but I
It looks like this question has been asked before, here and in other places
I know this kind of question has been asked before, for example here: Android:

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.