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: oidc implementation #187

Conversation

thisyahlen-deriv
Copy link

This pull request includes several changes across multiple files to improve the login flow using OAuth2, update dependencies, and add new utilities. The most important changes include updating the useHandleLogin hook, modifying the login and logout flows, and adding a new callback page.

Improvements to OAuth2 login flow:

  • src/hooks/useHandleLogin/index.tsx: Added a new useHandleLogin hook to handle the new login flow using OIDC. This hook redirects users to the OAuth2 authorization page if OAuth2 is enabled, or falls back to the legacy OAuth URL otherwise.
  • src/features/Callback/CallbackPage.tsx: Added a new CallbackPage component that handles the sign-in success callback by transforming account data and updating the login accounts.

Modifications to login and logout flows:

  • src/hooks/useLogout/index.tsx: Updated the useLogout hook to use the OAuth2Logout function from the @deriv-com/auth-client package, simplifying the logout process. [1] [2]
  • src/features/Login/Login.tsx, src/features/Apiexplorer/LoginDialog/index.tsx, src/components/UserNavbarItem/item.desktop.tsx: Modified these components to use the new handleLogin function from the useHandleLogin hook, ensuring a consistent login flow across the application. [1] [2] [3] [4] [5] [6] [7] [8] [9]

New utilities and test improvements:

  • src/utils/index.ts: Added a new transformAccountsFromResponseBody function to transform the response data from the accounts endpoint into an array of account objects. [1] [2]
  • src/utils/__tests__/utils.test.ts: Added tests for the new transformAccountsFromResponseBody function to ensure it correctly transforms the response data.

Dependency updates:

  • package.json: Updated the version of @deriv-com/auth-client dependency from ^1.0.29 to ^1.3.1.

Copy link

vercel bot commented Dec 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
deriv-api-docs ✅ Ready (Inspect) Visit Preview Dec 13, 2024 2:31am

@shafin-deriv shafin-deriv merged commit 6580145 into deriv-com:master Dec 13, 2024
3 checks passed
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.

3 participants