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

Github Authentication #52

Merged
merged 8 commits into from
Sep 11, 2023
Merged

Github Authentication #52

merged 8 commits into from
Sep 11, 2023

Conversation

VallariAg
Copy link
Member

@VallariAg VallariAg commented Aug 14, 2023

  1. Login button redirects to teuthology API's login
  2. User data is saved in cookies by the callback by this PR: Authentication callback teuthology-api#12
  3. Parse cookie data

For local setup, .env file:

VITE_PADDLES_SERVER=http://localhost:8080/
VITE_TEUTHOLOGY_API=http://localhost:8082/

TODO (refactoring):

  • Make a separate component Profile to show Username + Logout button in dropdown menu.
  • Logout button
  • Extract cookie data parser code in a helper file

Signed-off-by: Vallari <[email protected]>
1. redirect to teuthology API's login
2. AppBar uses cookie data to show username

Signed-off-by: Vallari <[email protected]>
@render
Copy link

render bot commented Aug 14, 2023

@netlify
Copy link

netlify bot commented Aug 14, 2023

Deploy Preview for pulpito ready!

Name Link
🔨 Latest commit 237c061
🔍 Latest deploy log https://app.netlify.com/sites/pulpito/deploys/64df6a85690a760008eb4c51
😎 Deploy Preview https://deploy-preview-52--pulpito.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@zmc zmc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't carefully read through the diffs on the two PRs yet, but I'm having a problem testing the functionality. I'm testing with docker-compose on a smithi, which of course requires not using localhost for the various URL values. The pulpito UI loads properly and shows the one scheduled run. When I click the login button, I'm first redirected to -api's /login, which redirects, to /login/, which then redirects to /login/None?client_id=None&scope=read:org

import.meta.env.VITE_TEUTHOLOGY_API || "";

function githubLogin() {
window.location.replace(`${TEUTHOLOGY_API_SERVER}/login`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If TEUTHOLOGY_API_SERVER has a trailing slash, the redirect fails

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should be using URL constructor, right! I'll add a trailing slash to login/ as well.

@VallariAg
Copy link
Member Author

VallariAg commented Aug 17, 2023

When I click the login button, I'm first redirected to -api's /login, which redirects, to /login/, which then redirects to /login/None?client_id=None&scope=read:org

This could be because of missing GH_AUTHORIZATION_BASE_URL variable in api's .env file. Maybe I can add a .env file without the secrets, only keynames.

src/lib/teuthologyAPI.ts Outdated Show resolved Hide resolved
This preserves the browser's history stack.
Also, add github icon to login button.

Signed-off-by: Vallari <[email protected]>
Extract cookie related code from Login component
to lib/teuthologyAPi.ts

Signed-off-by: Vallari <[email protected]>
Copy link
Member

@kamoltat kamoltat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked through this, test it locally as well using docker-compose. Everything works smoothly, so approved and merging!

@kamoltat kamoltat added the feature New feature or request label Sep 11, 2023
@kamoltat kamoltat merged commit 1e52914 into main Sep 11, 2023
@kamoltat kamoltat deleted the auth branch September 11, 2023 19:05
@VallariAg VallariAg linked an issue Sep 12, 2023 that may be closed by this pull request
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
Development

Successfully merging this pull request may close these issues.

Github Authentication
3 participants