Skip to content

Commit 381ffb8

Browse files
authored
Add authenticationMethod to sealed session (#1417)
## Description ## Documentation Does this require changes to the WorkOS Docs? E.g. the [API Reference](https://workos.com/docs/reference) or code snippets need updates. ``` [ ] Yes ``` If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required. <!-- av pr metadata This information is embedded by the av CLI when creating PRs to track the status of stacks when using Aviator. Please do not delete or edit this section of the PR. ``` {"parent":"main","parentHead":"","trunk":"main"} ``` -->
1 parent da9f834 commit 381ffb8

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/user-management/interfaces/authenticate-with-session-cookie.interface.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ export interface AccessToken {
1919

2020
export type SessionCookieData = Pick<
2121
AuthenticationResponse,
22-
'accessToken' | 'impersonator' | 'organizationId' | 'refreshToken' | 'user'
22+
| 'accessToken'
23+
| 'authenticationMethod'
24+
| 'impersonator'
25+
| 'organizationId'
26+
| 'refreshToken'
27+
| 'user'
2328
>;
2429

2530
export enum AuthenticateWithSessionCookieFailureReason {
@@ -35,6 +40,8 @@ export type AuthenticateWithSessionCookieFailedResponse = {
3540

3641
export type AuthenticateWithSessionCookieSuccessResponse = {
3742
authenticated: true;
43+
accessToken: string;
44+
authenticationMethod: AuthenticationResponse['authenticationMethod'];
3845
sessionId: string;
3946
organizationId?: string;
4047
role?: string;
@@ -44,5 +51,4 @@ export type AuthenticateWithSessionCookieSuccessResponse = {
4451
featureFlags?: string[];
4552
user: User;
4653
impersonator?: Impersonator;
47-
accessToken: string;
4854
};

src/user-management/session.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ export class CookieSession {
111111
entitlements,
112112
featureFlags,
113113
user: session.user,
114+
authenticationMethod: session.authenticationMethod,
114115
impersonator: session.impersonator,
115116
accessToken: session.accessToken,
116117
};
@@ -183,6 +184,7 @@ export class CookieSession {
183184
authenticated: true,
184185
sealedSession: authenticationResponse.sealedSession,
185186
session: authenticationResponse as AuthenticationResponse,
187+
authenticationMethod: authenticationResponse.authenticationMethod,
186188
sessionId,
187189
organizationId,
188190
role,

src/user-management/user-management.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ export class UserManagement {
496496
entitlements,
497497
featureFlags,
498498
accessToken: session.accessToken,
499+
authenticationMethod: session.authenticationMethod,
499500
};
500501
}
501502

@@ -630,6 +631,7 @@ export class UserManagement {
630631
user: authenticationResponse.user,
631632
accessToken: authenticationResponse.accessToken,
632633
refreshToken: authenticationResponse.refreshToken,
634+
authenticationMethod: authenticationResponse.authenticationMethod,
633635
impersonator: authenticationResponse.impersonator,
634636
};
635637

0 commit comments

Comments
 (0)