You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: adds handling of interaction_required error
updates CHANGELOG and README for onAuthResume
fix linting
remove stale debugging
updates README
OKTA-360883
<<<Jenkins Check-In of Tested SHA: 2918f28 for eng_productivity_ci_bot_okta@okta.com>>>
Artifact: okta-react
Copy file name to clipboardExpand all lines: CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,8 @@
1
+
# 5.1.0
2
+
3
+
### Features
4
+
-[#104](https://github.com/okta/okta-react/pull/104) Adds support for `onAuthResume` to `LoginCallback` for `interaction_required` OAuth errors (requires okta-auth-js 4.8+)
@@ -476,6 +477,40 @@ As with `Route` from `react-router-dom`, `<SecureRoute>` can take one of:
476
477
477
478
`LoginCallback` handles the callback after the redirect to and back from the Okta-hosted login page. By default, it parses the tokens from the uri, stores them, then redirects to `/`. If a `SecureRoute` caused the redirect, then the callback redirects to the secured route. For more advanced cases, this component can be copied to your own source tree and modified as needed.
478
479
480
+
#### errorComponent
481
+
482
+
By default, LoginCallback will display any errors from `authState.error`. If you wish to customise the display of such error messages, you can pass your own component as an `errorComponent` prop to `<LoginCallback>`. The `authState.error` value will be passed to the `errorComponent` as the `error` prop.
483
+
484
+
#### onAuthResume
485
+
486
+
When an external auth (such as a social IDP) redirects back to your application AND your Okta sign-in policies require additional authentication factors before authentication is complete, the redirect to your application redirectUri callback will be an `interaction_required` error.
487
+
488
+
An `interaction_required` error is an indication that you should resume the authentication flow. You can pass an `onAuthResume` function as a prop to `<LoginCallback>`, and the `<LoginCallback>` will call the `onAuthResume` function when an `interaction_required` error is returned to the redirectUri of your application.
489
+
490
+
If using the [Okta SignIn Widget][], redirecting to your login route will allow the widget to automatically resume your authentication transaction.
491
+
492
+
```jsx
493
+
// Example assumes you are using react-router with a customer-hosted Okta SignIn Widget on your /login route
494
+
// This code is wherever you have your <Security> component, which must be inside your <Router> for react-router
`withOktaAuth` is a [higher-order component][] which injects an [oktaAuth][Okta Auth SDK] instance and an [authState][AuthState] object as props into the component. Function-based components will want to use the `useOktaAuth` hook instead. These props provide a way for components to make decisions based on [authState][AuthState] or to call [Okta Auth SDK][] methods, such as `.signInWithRedirect()` or `.signOut()`. Components wrapped in `withOktaAuth()` need to be a child or descendant of a `<Security>` component to have the necessary context.
0 commit comments