Skip to content

Recommended Electron oauth2 flow is no longer valid. #1411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
minht11 opened this issue May 9, 2022 · 9 comments · Fixed by #1635
Closed

Recommended Electron oauth2 flow is no longer valid. #1411

minht11 opened this issue May 9, 2022 · 9 comments · Fixed by #1635
Assignees
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: question Request for information or clarification. Not an issue.

Comments

@minht11
Copy link

minht11 commented May 9, 2022

From August 2022 Google oauth2 iOS key will no longer support localhost redirects, this was a recommended way for Electron apps to use this library and still is inside the docs.

Given the policy changes what is the new recommended alternative? Just publishing client secret inside the app code?

@minht11 minht11 added priority: p3 Desirable enhancement or fix. May not be included in next release. type: question Request for information or clarification. Not an issue. labels May 9, 2022
@komret
Copy link

komret commented Jun 20, 2022

I am also wondering. I ended up with a backend server storing client_secret, but this is not a convenient solution and the library does not seem to support it out of the box. I would like to know:

  1. What is the security risk of exposing client_secret?
  2. If a server is recommended for storing client_secret and fetching the tokens, what is the best approach to combine it with this library?

@cronon
Copy link

cronon commented Nov 25, 2022

I've just faced the same problem, has anybody found a solution yet?

@komret
Copy link

komret commented Nov 25, 2022

We played it extra safe and created a backend authorization service so that we did not have to expose the client_secret, here's the implementation: trezor/trezor-suite#5669. Super annoying, especially if you do not need a backend otherwise.

@Theplayer592
Copy link

yh i've run into this problem recently too, and don't already have a backend. I'd much prefer to not have to create a whole sever just for this, so an alternative recommendation would be great.

@danielbankhead
Copy link
Contributor

Hey folks - we're working on improving support for this library on Electron. For now I'll remove this confusing documentation.

Additionally, if you don't want to spin up a separate backend (understandable) you can use GIS's OAuth 2 implicit flow and use its access token for requests: https://developers.google.com/identity/oauth2/web/guides/use-token-model. It's a bit tricky to wire-up with this library, but it is possible.

@Theplayer592
Copy link

how do you get around google's insistance on a javascript origin? Electron doesn't really have a URL

@hrueger
Copy link

hrueger commented Sep 2, 2023

Just as another usecase which is not possible with the current limitations:

I'm working on @cpvalente's https://github.com/cpvalente/ontime to provide support for syncing with google sheets. Since it is an open-source (Electron) app, we cannot include a client secret (not even as a secret at build time, since it can be unpacked easily). Also, we can't require users to create their own google cloud project, setup api keys or oauth and whatnot because that is just too complicated.

Electron doesn't really have a URL

Ontime can be used directly in the electron ui or by pointing a browser to the webserver it automatically hosts. Therefore, we do have a url. However, users can configure the port and when accessing it externally, we don't know the ip in advance. Therefore, we can't set valid web origins in our cloud project...

@hrueger
Copy link

hrueger commented Sep 7, 2023

@danielbankhead Thanks for taking a look at this.

we're working on improving support for this library on Electron

is there a separate issue tracking that (since this one is now closed)?

@danielbankhead
Copy link
Contributor

Here's a public tracking issue:

I've closed this via #1635 as outdated documentation was the original issue. In the meantime we're actively working on alternate runtime support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants