Code Monkey home page Code Monkey logo

electron-oauth2's People

Contributors

aguynamedben avatar hashtegner avatar hsar avatar ircnelson avatar javikr avatar jeffheifetz avatar johnf avatar jvitor83 avatar leviathan5 avatar mawie81 avatar mmathys avatar program247365 avatar

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  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  avatar  avatar  avatar  avatar  avatar  avatar

electron-oauth2's Issues

Opening in same BrowserWindow

Hi, thank you for this excellent library. It helped me a ton. It's a great reference for how to do OAuth2 in Electron, and it works out of the box without any issues. I have it working very well with jsforce.

I was wondering if you had considered an option that would allow the current BrowserWindow to be used for OAuth2 sign in. Is there a fundamental reason that wouldn't work? A lot of users find the alwaysOnTop option of the new BrowserWindow annoying, especially if they use a password manager to store passwords or need to Cmd-Tab over to Messages to get a 2FA code).

I'd be interested in doing the work to support same-window OAuth2 if you could point me in the right direction. Thanks a lot again for this great library.

Error: Object has been destroyed

Can you make a sample project of this?

Can't get it to work.

How do you catch the callback? There is no localhost server running.

Error: Object has been destroyed`

When I go back from the authorize to the callback.

Specify additional parameters in the token request?

Attempting to use electron-oauth2 with Azure Active Directory results in an error because the token request to AAD must specify the "resource" (internal terminology) that the token is to be redeemed against. This takes the form of an additional parameter in the token request, but there isn't any way to do this at the moment.

Implementation thoughts:
Since function tokenRequest(data) at index.js:75 does a queryString.stringify(data) call before sending its request, everything is in place except for a way to pass extra data into the data object.

Cannot read property 'BrowserWindow' of undefined

The only place I can require('electron-oauth2') is from src/system/index.js. When I require the npm in this file I do not get an error. I was able to make authorization work.

However, when it came time to move electron-oauth2 into antother file src/authorization/index.js, the simple act of requiring the npm throws an error

 TypeError: Cannot read property 'BrowserWindow' of undefined
      
      at Object.<anonymous> (node_modules/electron-oauth2/index.js:9:64)
      at Object.<anonymous> (src/authorization/index.js:2:22)
      at Object.<anonymous> (src/authorization/index.test.js:1:145)
          at <anonymous>

This line of code causes the above error in any file that I add it to except src/system/index.js which is the entry point for my main electron app.

var electronOauth2 = require('electron-oauth2')

I've tried making up new files and adding this this reqiure statement, it always fails. I've tried adding this require statement to the test, same error. But for some reason it will work from the main electron js file only. Adding this line to that file does not throw any errors during testing or during runtime. It doesn't matter if I use it or not, the mere act of requiring it throws the error.

Redirect URI

Hello, I am new to Electron. I wanted to know how to continue to another file after authenticating.
Currently after the authentication, the window just closes. Please help.
Thank you in advance!

BrowserWindow is not a constructor(…)

Hi,
I am getting this error, and I am very lost since a few days:

Uncaught (in promise) TypeError: BrowserWindow is not a constructor(…) Index.js:35

I would appreciate any help.

Why OAuth?

Why would you authenticate a public client with OAuth?

You have nowhere to hide the client secret so in the end everyone has access to all the data of all the users.

Crash after code received

I think this issue might be affecting this package:
electron/electron#4374

I'm using this package with GitHub GHE OAuth. I have values set for client ID, client secret, redirect URL, token URL, and redirect URI. Currently using Electron 1.3.1

Exception due to window already destroyed

In my case I get 'will-navigate' and a 'did-get-redirect-request' which means onCallback is called a second time. Resolving a promise a second time does not harm, but the window is already close on the first callback and therefore an exception is raised when trying to access it or close it again.

Another minor issue is that opts.additionalTokenRequestData throws an exception if no options object is passed in.

I will create a pull request.

oauth2 with Azure AD

I tried to authenticate against Azure AD and ran into some errors.

I'm not sure if it was the right way, but I had to add

, resource: config.resource

after line 87 in your index.js, because Azure needed the resource attribute in the request body to request an authorization code.
(See Use the authorization code to request an access token)

This was necessary to use a config like this:

var config = {     clientId: '111',     clientSecret: 'xxx',     authorizationUrl: 'https://login.microsoftonline.com/common/oauth2/authorize?',     tokenUrl: 'https://login.microsoftonline.com/common/oauth2/token',     useBasicAuthorizationHeader: false,     redirectUri: 'http://localhost',     resource: 'https://graph.windows.net/' };

Did I miss something, or is this attribute Azure-specific?

Has this been abandoned?

There seems to be very little activity & PRs that fix some breaking issues are not being merged.

Does this library handle Spotify Auth

I have been playing around with this lib and took the code from the example in thee Readme. After adding all of the config, Im still getting a failure after logging in with spotify login window.

The error is

INVALID_CLIENT: Invalid redirect URI

Wrong Code for AccessToken generation if secondary login with oAuth

This might somehow be related to #19 , but the result was a bit different for me...
Using OAuth to login in to streamjar, and logging in via oAuth with Mixer there returned the Code from Mixer that was meant for Streamjar because it resolves as soon as there is a code param...
I've got a quick fix that will check if the redirectUri is in the URI, will do a pull request

Secondary Oauth

I'm trying to use the library to process OAuth2 requests for Mixer.com. Mixer allows you to sign in with a Microsoft, Twitter or Discord account. The electron-oauth2 window will authenticate them with password login, however if they click sign in with Microsoft, they are presented with a blank login. I tried setting sandbox: true in the webPreferences of the parameters passed to the constructor, and that allows the child windows to display and authenticate with their respective services, however when I come back to Mixer and allow the oauth connection, it goes to a white screen and doesn't close the window or return the Auth and refresh tokens. Do you know if there's a way to return the credential with sandbox on, or is there another way to let these child windows be displayed without having to resort to sandbox mode?

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.