Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 newuseHandleLogin
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 newCallbackPage
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 theuseLogout
hook to use theOAuth2Logout
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 newhandleLogin
function from theuseHandleLogin
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 newtransformAccountsFromResponseBody
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 newtransformAccountsFromResponseBody
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
.