Giter Club home page Giter Club logo

electron-oauth-helper's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

electron-oauth-helper's Issues

Access Token Not Received

The login is completed and redirection happens but the response is not received. Am I doing something wrong?

`function googleAuth() {

const options = Object.assign({
    show: false,
    width: 480,
    height: 600,
    webPreferences: {
        nodeIntegration: false,
        contextIsolation: true,
    },
})

let window = new BrowserWindow(options)
window.once("ready-to-show", () => {
    window.show()
})
window.once("closed", () => {
    window = null
})

const GoogleClientWebApp = {
    client_id: GOOGLE_CLIENT_ID,
    client_secret: GOOGLE_CLIENT_SECRET,
    redirect_uri: GOOGLE_REDIRECT_URI,
    authorize_url: "https://accounts.google.com/o/oauth2/v2/auth",
    response_type: "token",
    scope: "https://www.googleapis.com/auth/userinfo.profile",
}


const config = GoogleClientWebApp;
const provider = new OAuth2Provider(config)

provider.perform(window)
    .then(resp => {
        console.log("Response", resp)
    })
    .catch(error => console.error(error))

}`

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml
  • The new Node.js version is in-range for the engines in 1 of your package.json files, so that was left alone

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

This dependency was not found

$ npm install electron-oauth-helper --save

import OAuth2Provider from "electron-oauth-helper/oauth2"

$ npm run electron:serve

 ERROR  Failed to compile with 1 errors6:48:48 PM

This dependency was not found:

* electron-oauth-helper/oauth2 in ./src/background.js

To install it, you can run: npm install --save electron-oauth-helper/oauth2
 ERROR  Build failed with errors.

$ npm install --save electron-oauth-helper/oauth2

npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128

?

How do ensure security in desktop apps?

https://github.com/mironal/electron-oauth-helper/blob/master/example/src/main/config.example.js
Isn't there a security concern about using secret information such as client_id and client_secret in the client-side code, as shown in the example?

For example, is it possible for this third party to impersonate the same application?
If this concern exists, would it be ideal to build a workflow through the server-side?

I apologize if this is a strange question.

Facing issue in v5.1.0

Description: @mironal Please check last PR code was not found in the latest release.

Can you please re-publish the package with the latest code on npm

[Question] I can't connect with firebase ...

Hello sorry for my english ... i have that code in the main.js ->
(i am using electron-vue)

// firebase
const { OAuth2Provider } = require('electron-oauth-helper')

const firebase = require('firebase')
const queryString = require('query-string')
const mapTypeToConfig = require('../../services/config')

firebase.initializeApp(mapTypeToConfig('Firebase'))

const config = mapTypeToConfig('Firebase')
const provider = new OAuth2Provider(config)

provider.perform().then(resp => {
  const query = queryString.parse(resp)
  const credential = firebase.auth.GoogleAuthProvider.credential(query.access_token)
  firebase.auth().signInWithCredential(credential)
    .then(user => { console.log(user) }).catch(error => console.error(error))
}).catch(error => console.error(error))
// firebase

and i have the next error -->

home/matias/git/LearniaInteractive/node_modules/electron-oauth-helper/lib/helper.js:49 Uncaught TypeError: BrowserWindow is not a constructor
    at createVanillaWindow (/home/matias/git/LearniaInteractive/node_modules/electron-oauth-helper/lib/helper.js:49)
    at OAuth2Provider.perform (/home/matias/git/LearniaInteractive/node_modules/electron-oauth-helper/lib/oauth2.js:116)
    at eval (main.js?3b76:30)
    at Object.<anonymous> (renderer.js:897)
    at __webpack_require__ (renderer.js:680)
    at fn (renderer.js:90)
    at Object.<anonymous> (renderer.js:814)
    at __webpack_require__ (renderer.js:680)
    at renderer.js:726
    at renderer.js:729

whats is wrong? :D Sorry i am not very good in javascript ...

Thanks for the module :)

OAuth2-Authorize-URL is not created correctly when "authorize_url" configuration contains URL parameters

"electron-oauth-helper": "5.0.0",

In the file:

/lib/oauth2/helper.ts

the code

const authorizeUrl = `${config.authorize_url}?${querystring.stringify(
  authorizeParameters,
)}`

does not create a correct OAuth2-Authorize-URL in case the URL stored in config.authorize_url already has URL parameters.

For example the config.authorize_url https://example/oauth2/auth?lang=en would be converted to the OAuth2-Authorize-URL https://example/oauth2/auth?lang=en?client_id=XXXXXX&redirect_uri=YYYYYY&... which has two question marks and thereby will most likely not work as intended in most OAuth2-Environments.

This problem seems to affect many if not all earlier versions of the OAuth-Helper as well.

OAuth2Provider is not a constructor

Hello, does it work with >= electron 11.2.1 ?

(node:9925) UnhandledPromiseRejectionWarning: TypeError: OAuth2Provider is not a constructor at createWindow (/Users/yb/PhpstormProjects/desktop/electron/main.js:169:22) at switchErpSystem (/Users/yb/PhpstormProjects/desktop/electron/main.js:713:13) at init (/Users/yb/PhpstormProjects/desktop/electron/main.js:317:5) at /Users/yb/PhpstormProjects/desktop/electron/main.js:363:36

Not getting response from provder.perform(window) (Possible update)

Hey so Ive been trying to implement your plugin but I had to hack about to get it to work.
Im using ionic's capacitor to generate electron and using Angular 7 as my framework.
The electron version is:

"electron": "^4.1.4",
"electron-oauth-helper": "^3.0.0",
 "firebase": "5.6.0"

Using your docs I tried implementing everything as you have described in the docs and got no response from the new window.

const provider = new OAuth2Provider(mapTypeToConfig('GoogleClientWebApp'));

    const options = Object.assign({
        show: false,
        width: 800,
        height: 800,
        webPreferences: {
            nodeIntegration: false,
            contextIsolation: true,
        },
    })

    let window = new BrowserWindow(options);
    window.once("ready-to-show", () => {
        window.show()
    })
    window.once("closed", () => {
            window = null
        })
provider.perform(window).then(resp => {
      // window.close()
      console.log("Got response (◍•ᴗ•◍):", resp)// <-- Never gets to here
}).catch(error => console.error(error))

I had a dig through the code and discovered in redirect.js this line never finished executing

webContents.session.webRequest.onBeforeRedirect({ urls: [redirectURL] },
            detail => {
                // Never got to here
                debug("will redirect", detail.redirectURL)
                if (isRedirectURL(detail.redirectURL)) {
                    resolve(detail.redirectURL)
                }
            }
        )

But by altering the code to use a string instead of an array fixes it. Ive no idea why it just works after. It could be a possible update to electrn under the hood?

webContents.session.webRequest.onBeforeRedirect({ urls: redirectURL },
            detail => {
                debug("will redirect", detail.redirectURL)
                if (isRedirectURL(detail.redirectURL)) {
                    resolve(detail.redirectURL)
                }
            }
        )

I thought this might be helpful incase anyone comes accross this too

White page and no code after authorization

Hey there, I am using electron 2 + electron-vue and I am trying to get the oAuth token from anilist.co by using this project.

After successfully logging into anilist and allowing access, I am getting redirected to my redirect-uri, get no code reported back and get a few errors in my console.

image

This is my code to access the auth window:

import { OAuth2Provider } from 'electron-oauth-helper';
import config from './config';
const provider = new OAuth2Provider(config.oauth);

ipcMain.on('auth', (event, arg) => {
  provider.perform(oAuthWindow)
      .then(resp => {
        console.log(resp)
      })
      .catch(error => console.error(error));
});

and my config file:

module.exports = {
    oauth: {
        client_id: 'ID_HERE',
        client_secret: 'SECRET_HERE',
        authorize_url: 'https://anilist.co/api/v2/oauth/authorize',
        access_token_url: 'https://anilist.co/api/v2/oauth/token',
        redirect_uri: 'http://localhost:9080',
        response_type: 'code'
    }
};

OAuth1Provider and OAuth2Provider is undefined

Hi,

I'm trying to use your electron-oauth-helper referring your example.
But OAuth1Provider and OAuth2Provider is always undefined with this code.

const { 
  OAuth1Provider, 
  OAuth2Provider 
} = require("electron").remote.require("electron-oauth-helper")

Any help?

Problems with login by google account

i have use this library for more than a year and I've never had this problem, when i try to log in with my google account the app redirect in a loop to the url where you select your mail.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.