https://github.com/parro-it/electron-google-oauth
Google api access token in electron
https://github.com/parro-it/electron-google-oauth
Last synced: 9 months ago
JSON representation
Google api access token in electron
- Host: GitHub
- URL: https://github.com/parro-it/electron-google-oauth
- Owner: parro-it
- License: mit
- Created: 2015-08-21T06:34:04.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-03-02T09:42:02.000Z (almost 8 years ago)
- Last Synced: 2025-04-30T08:12:43.381Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 24.4 KB
- Stars: 56
- Watchers: 5
- Forks: 16
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# electron-google-oauth
Get Google api access token using an electron window
to let the user authorize the app.
[](http://travis-ci.org/parro-it/electron-google-oauth)
## Installation
```bash
npm install --save electron-google-oauth
```
## Usage
```javascript
import electronGoogleOauth from 'electron-google-oauth';
const browserWindowParams = {
'use-content-size': true,
center: true,
show: false,
resizable: false,
'always-on-top': true,
'standard-window': true,
'auto-hide-menu-bar': true,
'node-integration': false
};
const googleOauth = electronGoogleOauth(browserWindowParams);
( async () => {
// retrieve authorization code only
const authCode = await googleOauth.getAuthorizationCode(
['https://www.google.com/m8/feeds'],
'your-client-id',
'your-client-secret',
'your-redirect-uri'
);
console.dir(authCode);
// retrieve access token and refresh token
const result = await googleOauth.getAccessToken(
['https://www.google.com/m8/feeds'],
'your-client-id',
'your-client-secret',
'your-redirect-uri'
);
console.dir(result);
})();
```
## Testing
To test the library, clone this git repo, then define CLIENTSECRET and CLIENTID environment variables holding your Google API details, then run:
```bash
npm install
npm start
```
## License
The MIT License (MIT)
Copyright (c) 2015 Andrea Parodi