Skip to content
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

Feat: If PKCE AuthorizationClient cannot open browser, ask user to do so manually #1947

Merged
merged 2 commits into from
Nov 9, 2023

Conversation

fg91
Copy link
Member

@fg91 fg91 commented Nov 9, 2023

TL;DR

The PKCE AuthorizationClient automatically opens a browser tab/window with the /authorize endpoint in order to receive the authorization code.

When ssh-ing into VMs, the browser window cannot be automatically opened. If one port-forwards the port used by the callback server, a pkce flow could still be done if only the authorization endpoint could be opened in the user's browser.

In this PR I change the AuthorizationClient so that it first tries to open the browser window automatically - as is already the case - but if this is not successful, simply asks the user to open the link.

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

Complete description

NA

Tracking Issue

NA

Follow-up issue

NA

…nually

Signed-off-by: Fabio Grätz <fabiogratz@googlemail.com>
@fg91 fg91 force-pushed the fg91/feat/pkce-open-browser-manually branch from 34cef30 to 2fb0e8e Compare November 9, 2023 13:11
Copy link

codecov bot commented Nov 9, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (6998304) 62.71% compared to head (4bb5640) 62.70%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1947      +/-   ##
==========================================
- Coverage   62.71%   62.70%   -0.01%     
==========================================
  Files         313      313              
  Lines       23178    23181       +3     
  Branches     3510     3511       +1     
==========================================
+ Hits        14535    14536       +1     
- Misses       8221     8223       +2     
  Partials      422      422              
Files Coverage Δ
flytekit/clients/auth/auth_client.py 32.43% <25.00%> (+0.01%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

eapolinario
eapolinario previously approved these changes Nov 9, 2023
flytekit/clients/auth/auth_client.py Outdated Show resolved Hide resolved
Signed-off-by: Fabio Grätz <fabiogratz@googlemail.com>
@fg91 fg91 force-pushed the fg91/feat/pkce-open-browser-manually branch from 65b1129 to 4bb5640 Compare November 9, 2023 19:55
@eapolinario eapolinario merged commit 94a561c into master Nov 9, 2023
71 of 73 checks passed
ringohoffman pushed a commit to ringohoffman/flytekit that referenced this pull request Nov 24, 2023
… so manually (flyteorg#1947)

* If PKCE AuthorizationClient cannot open browser, ask user to do so manually

Signed-off-by: Fabio Grätz <fabiogratz@googlemail.com>

* Remove new line

Signed-off-by: Fabio Grätz <fabiogratz@googlemail.com>

---------

Signed-off-by: Fabio Grätz <fabiogratz@googlemail.com>
Co-authored-by: Fabio Grätz <fabiogratz@googlemail.com>
RRap0so pushed a commit to RRap0so/flytekit that referenced this pull request Dec 15, 2023
… so manually (flyteorg#1947)

* If PKCE AuthorizationClient cannot open browser, ask user to do so manually

Signed-off-by: Fabio Grätz <fabiogratz@googlemail.com>

* Remove new line

Signed-off-by: Fabio Grätz <fabiogratz@googlemail.com>

---------

Signed-off-by: Fabio Grätz <fabiogratz@googlemail.com>
Co-authored-by: Fabio Grätz <fabiogratz@googlemail.com>
Signed-off-by: Rafael Raposo <rafaelraposo@spotify.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants