Skip to content
Merged
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
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.14.0"
"@workos-inc/authkit-js": "0.17.0"
}
}
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export {
} from "@workos-inc/authkit-js";
export type {
User,
AuthenticationMethod,
Copy link
Member

Choose a reason for hiding this comment

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

@ohjonah I just released authkit-js v0.17.0, which included your change to introduce AuthenticationMethod. We'll need to upgrade authkit-js in authkit-react in this PR to get it working.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sweet! Doing that now - thanks for the review!!

AuthenticationResponse,
JWTPayload,
OnRefreshResponse,
Expand Down
5 changes: 4 additions & 1 deletion src/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export function AuthKitProvider(props: AuthKitProviderProps) {
accessToken,
organizationId = null,
impersonator = null,
authenticationMethod = null,
} = response;
const {
role = null,
Expand All @@ -57,6 +58,7 @@ export function AuthKitProvider(props: AuthKitProviderProps) {
permissions,
featureFlags,
impersonator,
authenticationMethod,
};
return isEquivalentWorkOSSession(prev, next) ? prev : next;
});
Expand Down Expand Up @@ -127,7 +129,8 @@ function isEquivalentWorkOSSession(
a.featureFlags.length === b.featureFlags.length &&
a.featureFlags.every((flag, i) => flag === b.featureFlags[i]) &&
a.impersonator?.email === b.impersonator?.email &&
a.impersonator?.reason === b.impersonator?.reason
a.impersonator?.reason === b.impersonator?.reason &&
a.authenticationMethod === b.authenticationMethod
);
}

Expand Down
4 changes: 3 additions & 1 deletion src/state.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { User } from "@workos-inc/authkit-js";
import { User, AuthenticationMethod } from "@workos-inc/authkit-js";

export interface Impersonator {
email: string;
Expand All @@ -14,6 +14,7 @@ export interface State {
permissions: string[];
featureFlags: string[];
impersonator: Impersonator | null;
authenticationMethod: AuthenticationMethod | null;
}

export const initialState: State = {
Expand All @@ -25,4 +26,5 @@ export const initialState: State = {
permissions: [],
featureFlags: [],
impersonator: null,
authenticationMethod: null,
};