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(opentrons-ai-client): add auth0 package #15148

Merged
merged 20 commits into from
May 16, 2024
Merged

Conversation

koji
Copy link
Contributor

@koji koji commented May 9, 2024

Overview

add auth0 package and useAuth0 hook to check the status of authentication and add logout button (this is for dev)
use getAccessTokenSilently to get access token from Auth0.

https://auth0.com/docs/get-started/applications/confidential-and-public-applications/user-consent-and-third-party-applications

close AUTH-204 AUTH-396

Test Plan

  1. make -C opentrons-ai-client

  2. go to localhost:5173

  3. the browser will be redirected to auth0 login/sign up page

  4. log in (if you don't have an account, please sign up)

  5. check the chat ui is shown

  6. fill out the textarea and click send button
    Check the app will receive the output from the BE (this would take some time)
    In terms of the response display issue, it will be solved by this pr.
    Also I have a refactoring PR to fix current component structure issue (data fetch and token retrieving are done in InputPrompt component)

  7. click logout button
    Check when clicking the logout button, the browser will show the login page again

Changelog

Review requests

Risk assessment

low

add auth0 package

close AUTH-
@koji koji requested review from y3rsh and shlokamin May 9, 2024 19:01
@koji koji marked this pull request as ready for review May 9, 2024 19:02
@koji koji requested a review from a team as a code owner May 9, 2024 19:02
@koji koji marked this pull request as draft May 9, 2024 19:07
@koji
Copy link
Contributor Author

koji commented May 9, 2024

  • add logout button (dev purpose)
  • update test

@koji koji marked this pull request as ready for review May 13, 2024 15:00
@koji koji removed the request for review from a team May 13, 2024 18:52
Comment on lines 24 to 27
// if not authenticated redirect to login page
if (!isAuthenticated) {
window.location.href = LOGIN_PAGE_URL
}
Copy link
Collaborator

@y3rsh y3rsh May 14, 2024

Choose a reason for hiding this comment

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

You will need to use the button or see if they have a function. Going to the URL is not enough, the package builds a URL using the client id and it also includes where to call back to once authenticated. When I use this locally it works.

<div>
  {!isAuthenticated && (
    <button onClick={() => loginWithRedirect()}>Log in</button>
  )}
</div>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks @y3rsh. updated that part.

@koji koji requested a review from y3rsh May 14, 2024 23:12
@koji koji requested a review from ncdiehl11 May 15, 2024 01:10
@koji
Copy link
Contributor Author

koji commented May 15, 2024

  • fix test error

@koji koji requested a review from jerader May 15, 2024 19:57
Copy link
Collaborator

@y3rsh y3rsh left a comment

Choose a reason for hiding this comment

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

This works for me locally.

@koji koji merged commit cfdcdf6 into edge May 16, 2024
30 checks passed
@koji koji deleted the feat_add-auth0-provider branch May 16, 2024 15:59
Carlos-fernandez pushed a commit that referenced this pull request May 20, 2024
* feat(opentrons-ai-client): add auth0 package
Carlos-fernandez pushed a commit that referenced this pull request Jun 3, 2024
* feat(opentrons-ai-client): add auth0 package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants