parro-it / electron-google-oauth

Google api access token in electron
MIT License
56 stars 18 forks source link

authorizeApp promise hung #12

Closed ghost closed 7 years ago

ghost commented 7 years ago

Greetings, during debug managed to determine that in function authorizeApp promise, win.on('page-title-updated') promise return anything only if title start with "Denied" or "Success", while in my case I got "Sign in - Google accounts". While it may be that I still not put this package in correct way, Promise must return some result in all possible cases, to not spend time on debugging library itself.

Thanks.

parro-it commented 7 years ago

It probably should be better to reject the promise if the user is not logged in. Do you mind doing a PR? Thank you!

ghost commented 7 years ago

Sure, just will reach some working version of this part in my app first.

parro-it commented 7 years ago

Fine, thank you so much!

ghost commented 7 years ago

Finally managed to run it successfully. So how it ends up:

  1. WindowParams in example has show: false, don't understand why. Myself changed show to true and added width and height.
  2. Then code is concise for sure, but if somethings returns error then nothing happens, and even harder to debug stuff - no means present for that.
    1. For some reason when I copy redirect uri 'urn:ietf:wg:oauth:2.0:oob' and put into getAuthorizationCode and getAccessCode get error in use of fetch. Working suite was: oauth type: other in google developer console, and omitting redirect uri in functions mentioned.

So I recommend to add hooks for debug and some better documentation along with reasons for given values, explanation where need to put this code (in main process, since it create window, newby hint but I think we better help new guys) and link to google oauth docs for installed apps.

ghost commented 7 years ago

Hmmm seems this promise must hung in order to not return undefined before user have chance to authorize. Then I was wrong and everything okay with that promise. But still some documentation would be really useful.

parro-it commented 7 years ago

Do you mind doing a PR with added documentation you explain above?

ghost commented 7 years ago

Well first better add debug hooks, check what kind of errors may happen, that we can see them. Piece of work this is. Just I will complete it bit long - have much stuff on me right now. Want me to do this?