New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@electron-utils/electron-oauth-github

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@electron-utils/electron-oauth-github

Electron helper for OAuth authorization to Github using web application flow strategy.

latest
npmnpm
Version
0.2.4
Version published
Maintainers
1
Created
Source

Electron OAuth Github package.

How to use it ?

This package, helps with OAuth authorization from Github. It uses web application flow described here: https://docs.github.com/en/free-pro-team@latest/developers/apps/authorizing-oauth-apps#web-application-flow

Package is exposing 2 functions:

module.exports = {
    getAuthorizationCode,
    getAccessToken
}

To obtain Access Token, (which is the reason of this package), you need to use only getAccessToken function. This function uses getAuthorizationCode underneath. When you obtain access token, you can than make request to Github Rest API with it.

npm install @electron-utils/electron-oauth-github
yarn add @electron-utils/electron-oauth-github
const {getAccessToken} = require('@electron-utils/electron-oauth-github')

try {
    const {access_token} = await getAccessToken({
      clientId: "your github app client id",
      clientSecret: "your github  app client secret",
      redirectUri: "your rediretion uri",
      scope: "scope of permissions you want to give"
    })

    mainWindow.webContents.send('accessToken', access_token) // here, we just send access token to frontend part of electron app (to mainWindow)
  } catch (error) {
    console.log("error happened")
    console.log(error)
  }

Development

git clone git@github.com:marckraw/electron-oauth-github.git
yarn link 

To use dev version, with you Electron application.

Build and deploy

There is no, build / bundling process for it, for now. When merged to master via PR, github action is fired, which deploy package to npm global registry.

Is it production ready?

You should consider this as a testing/preview package. I needed this for my personal projects, so i've built it and publish it :) If there will be enough interest in it, we can try to make it fully legit. Feel free to create issues, and also pull request.

Keywords

electron

FAQs

Package last updated on 30 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts