Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cardinalby/google-api-fetch-token-action
Call Google Auth API to prevent you refresh token being expired
https://github.com/cardinalby/google-api-fetch-token-action
Last synced: about 5 hours ago
JSON representation
Call Google Auth API to prevent you refresh token being expired
- Host: GitHub
- URL: https://github.com/cardinalby/google-api-fetch-token-action
- Owner: cardinalby
- License: mit
- Created: 2020-06-22T17:45:15.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-01T19:42:56.000Z (7 months ago)
- Last Synced: 2024-10-26T09:36:05.090Z (12 days ago)
- Language: TypeScript
- Size: 103 KB
- Stars: 6
- Watchers: 1
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - cardinalby/google-api-fetch-token-action - Call Google Auth API to prevent you refresh token being expired (TypeScript)
README
![Build Status](https://github.com/cardinalby/google-api-fetch-token-action/workflows/build-test/badge.svg)
# The purpose
The action fetches an access token from Google API.
It can be used to **prevent your Refresh Token from being expired**.
According to [Google's guide](https://developers.google.com/identity/protocols/oauth2#expiration),
the refresh token might stop working if it has not been used for six months.If you use it in your workflow running less often than 6 months, you can face the problem.
[Schedule](https://help.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule)
this action to periodically access Google API and fetch access token to avoid that.Based on [typed-chrome-webstore-api](https://www.npmjs.com/package/typed-chrome-webstore-api) package.
## About Google API access
To setup API access you need to specify `clientId`, `clientSecret` and `refreshToken` inputs.
To find out how to obtain them you can read:
* [Using the Chrome Web Store Publish API](https://developer.chrome.com/webstore/using_webstore_api)
* [How to generate Google API keys](https://github.com/DrewML/chrome-webstore-upload/blob/master/How%20to%20generate%20Google%20API%20keys.md)## Inputs
* `clientId` **Required**
* `clientSecret` **Required**
* `refreshToken` **Required**Don't forget to store these values in secrets!
## Outputs
* `accessToken` fetched access token## Usage example
Create a separate workflow with a scheduled job:
```yaml
name: "fetch-access-token"
on:
schedule:
- cron: '0 3 2 * *' # At 03:00 on day-of-month 2jobs:
fetchToken:
runs-on: ubuntu-latest
steps:
- uses: cardinalby/google-api-fetch-token-action@v1
with:
clientId: ${{ secrets.G_API_CLIENT_ID }}
clientSecret: ${{ secrets.G_API_CLIENT_SECRET }}
refreshToken: ${{ secrets.G_API_REFRESH_TOKEN }}
```## See also
If you are developing WebExtension for Google Web Store, take a look at
[webext-buildtools-chrome-webstore-action](https://github.com/cardinalby/webext-buildtools-chrome-webstore-action)
to upload and publish your extension. It works nice together with this action utilizing the same refresh token.If you are interested in the building the entire deployment workflow for WebExtension,
you can read this [article](https://cardinalby.github.io/blog/post/github-actions/webext/1-introduction/).