Skip to content

Commit 0e88cda

Browse files
All authentication methods should pass ipAddress and userAgent (#861)
## 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.
1 parent 11ddad5 commit 0e88cda

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

src/users/interfaces/authenticate-with-code-options.interface.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
export interface AuthenticateWithCodeOptions {
22
clientId: string;
33
code: string;
4+
ipAddress?: string;
5+
userAgent?: string;
46
}
57

68
export interface AuthenticateUserWithCodeCredentials {
@@ -12,4 +14,6 @@ export interface SerializedAuthenticateWithCodeOptions {
1214
client_id: string;
1315
client_secret: string | undefined;
1416
code: string;
17+
ip_address?: string;
18+
user_agent?: string;
1519
}

src/users/interfaces/authenticate-with-totp-options.interface.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ export interface AuthenticateWithTotpOptions {
33
code: string;
44
pendingAuthenticationToken: string;
55
authenticationChallengeId: string;
6+
ipAddress?: string;
7+
userAgent?: string;
68
}
79

810
export interface AuthenticateUserWithTotpCredentials {
@@ -16,4 +18,6 @@ export interface SerializedAuthenticateWithTotpOptions {
1618
code: string;
1719
pending_authentication_token: string;
1820
authentication_challenge_id: string;
21+
ip_address?: string;
22+
user_agent?: string;
1923
}

src/users/serializers/authenticate-with-code-options.serializer.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ export const serializeAuthenticateWithCodeOptions = (
1111
client_id: options.clientId,
1212
client_secret: options.clientSecret,
1313
code: options.code,
14+
ip_address: options.ipAddress,
15+
user_agent: options.userAgent,
1416
});

src/users/serializers/authenticate-with-totp-options.serializer.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import {} from '../interfaces';
21
import {
32
AuthenticateUserWithTotpCredentials,
43
AuthenticateWithTotpOptions,
54
SerializedAuthenticateWithTotpOptions,
6-
} from '../interfaces/authenticate-with-totp-options.interface';
5+
} from '../interfaces';
76

87
export const serializeAuthenticateWithTotpOptions = (
98
options: AuthenticateWithTotpOptions & AuthenticateUserWithTotpCredentials,
@@ -14,4 +13,6 @@ export const serializeAuthenticateWithTotpOptions = (
1413
code: options.code,
1514
authentication_challenge_id: options.authenticationChallengeId,
1615
pending_authentication_token: options.pendingAuthenticationToken,
16+
ip_address: options.ipAddress,
17+
user_agent: options.userAgent,
1718
});

0 commit comments

Comments
 (0)