Skip to content

derfmilo/electron-gauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

electron-gauth

Get Google api access token using an electron window to let the user authorize the app.

Installation

npm install --save electron-gauth

Usage

  import electronGoogleOauth from 'electron-gauth';

  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

Build the app, then run it:

npm run build && electron dist/bin.js --scopes 'SCOPES' --clientId 'CLIENTID' --clientSecret 'CLIENTSECRET' --redirectUri 'REDIRECTURI'

License

The MIT License (MIT)

Copyright (c) 2015 Andrea Parodi Copyright (c) 2018 Milo Thompson

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors