I am using Google APIs in my application and the oauth2 refresh token expires after 1 hour. I am using this refresh token to execute a task which runs daily. I create the refresh token using the OAuth2 playground. Is there a way to extend the expiration time of a refresh token? (1 month)
GoogleAPI oauth2 refresh token expires in 1 hour
4.3k Views Asked by Madhuka Harith At
2
There are 2 best solutions below
3
Nicolas Garnier
On
As already explained the refresh tokens created using the OAuth 2.0 Playground are automatically revoked after a few hours because the playground is mainly for testing purposes. However you can configure the OAuth playground to use your own app credentials (use the 'wheely' icon top right). If you use your own app credentials the refresh token will not be revoked.
That said it looks like you want to run a background service that accesses Google APIs. For this you may want to use a Service Account if you are not accessing a specific user's data.
Related Questions in OAUTH
- Using html5 localstorage instead of cookies with passport.js
- OAuth integration with QuickBooks using Scribe
- OAuth with Developer tokens
- Oauth in Tyrus WebSocket
- Accessing Picasa Web API using PHP
- how can I access user details through "oauth_token" from twitter api in ionic framework
- Is my JWT refresh plan secure?
- When to refresh token?
- SignalR oAuth on self host
- Bearer token in MVC controller to access Web API
- OAuthorization through app or web api
- Authenticating mobile app login using webservice using oauth connection
- Testing local rails application with OAuth
- Configure the authorization server endpoint
- Azure Active Directory Login: Web App Permissions, User Consent not triggered
Related Questions in GOOGLE-API
- Google Logging API - What service name to use when writing entries from non-Google application?
- Why I receive CERTIFICATE_VERIFY_FAILED from google adwords api?
- Google plus API not return the Email address
- getting google contacts using shuttlecloud
- finished with non-zero exit value 2 when I use google login api
- Unable to authenticate with Google through the Java SDK for reading spreadsheet data
- Youtube API - Listing hidden videos of my channel using OAuth
- How to update ACL of a file in Google Cloud Storage using Java API
- What is the difference between Android API and Google API?
- Freebase Search API - Get All Results
- Google Developer API V3 for video upload in YouTube C#.net
- Google places maps Api web service post new place
- Limited number of rows returned from Google spreadsheet and the Sheets Api
- Gmail API: Insufficient Permission
- Use custom image for google signin button
Related Questions in GOOGLE-OAUTH
- Not getting refresh token with google oauth2
- getting google contacts using shuttlecloud
- How to use Authentication again after it was granted prevously
- Youtube API - Listing hidden videos of my channel using OAuth
- How can I make a copy of a file in Google Drive via Python?
- Error "Invalid token: Cannot parse referred token string" when trying to access to Picasaweb API with oAuth2 from Java
- Need to run getAuthToken twice before receiving access token, why?
- Retrieve Google Sites's Domain Index feed using OAuth 2.0 with Service Account
- On App Engine using Go, correct method for using OAuth2
- Google App Engine Python - YouTube API v3 - Insufficient Permission
- How to set redirect URI with pattern for OAuth 2 with Google?
- Not able to extract access token google service account
- What Google Account is associated with an OAuth Client ID?
- Accessing Google api with multi user
- Unauthorized Client Exception with Google Drive Service Account
Related Questions in OAUTH2-PLAYGROUND
- Google + access token insufficient permission
- batch request on google group api with oauth2-playground
- OAuth2 playground 503 Backend Error while Clear event
- Does Google OAuth2.0 support an OAuth-flow for a Resource Owner Password Credential Flow?
- Gmail API throwing 401 Unauthorized
- OAuth 2.0 Playground - Upload Image - POST - How to name file
- Oauth2 Playground exchange authorization code for token: 400 error
- Get warnings when generating ads report by calling Google AdSense API
- OAuth 2.0 Playground - Alert API not working
- Create access token and refresh token from oauth2 playground
- 404 Not Found - "message": "Requested entity was not found." when requesting URI mybusinessaccountmanagement.googleapis.com
- How do API Data Studio scopes works?
- FusionTables Insert works in OAuth2 Playground, but not as HTTPS Post in other systems
- oauth2.0 invalid request when trying to use refresh token
- NullPointerException at WSO2-IS v4.0.0m9 and OAuth 2.0 playground
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I think that you have your terms confused here.
As per Oauth2 access tokens expire after one hour. Access tokens are used to request access of an api and return the data that you need. There is no way to extend the lifetime of an access token beyond one hour. You need to use a refresh token to request a new access token.
Refresh tokens are extremely long lived and do not normally expire. Refresh tokens are used to request a new access token. Refresh tokens for the most part do not expire if one is not used in six months though google will automatically expire it. Also if the user removes your access then the refresh token will also automatically expire.
If you are creating your refresh token using the Outh2 playground which is intended only for testing purposes it will also expire.
If you are using the oauth2 playground to create your refresh token then you should not be doing this you should be creating your own application to request the tokens.