Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ takes the following props:
- `onRedirectCallback`: Called after exchanging the
`authorization_code`. Can be used for things like redirecting to a "return
to" path in the OAuth state.
- `onRefreshFailure`: Called when the session fails to refresh. Can be used to redirect the user to the sign in page or update the UI.

### `useAuth`

Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
"react": ">=17"
},
"dependencies": {
"@workos-inc/authkit-js": "0.7.1"
"@workos-inc/authkit-js": "0.7.2"
}
}
5 changes: 4 additions & 1 deletion src/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import { Context } from "./context";
import { Client, CreateClientOptions } from "./types";
import { initialState } from "./state";

// TODO: delete this after authkit-js exports it
type onRefreshResponse = Omit<AuthenticationResponse, "refreshToken">;

interface AuthKitProviderProps extends CreateClientOptions {
clientId: string;
children: React.ReactNode;
Expand All @@ -34,7 +37,7 @@ export function AuthKitProvider(props: AuthKitProviderProps) {
const [state, setState] = React.useState(initialState);

const handleRefresh = React.useCallback(
(response: AuthenticationResponse) => {
(response: onRefreshResponse) => {
const { user, accessToken, organizationId } = response;
const { role = null, permissions = [] } = getClaims(accessToken);
setState((prev) => {
Expand Down
Loading