Skip to content

Commit

Permalink
Update enrollAuthFactor method (#903)
Browse files Browse the repository at this point in the history
## 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.



#### PR Dependency Tree


* **PR #903** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)
  • Loading branch information
danerwilliams authored Nov 21, 2023
1 parent a8e2827 commit 39dbc89
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
export interface EnrollAuthFactorOptions {
userId: string;
type: 'totp';
totpIssuer: string;
totpUser: string;
totpIssuer?: string;
totpUser?: string;
}

export interface SerializedEnrollUserInMfaFactorOptions {
type: 'totp';
totp_issuer: string;
totp_user: string;
totp_issuer?: string;
totp_user?: string;
}
4 changes: 2 additions & 2 deletions src/user-management/user-management.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ describe('UserManagement', () => {

describe('enrollAuthFactor', () => {
it('sends an enrollAuthFactor request', async () => {
mock.onPost(`/user_management/${userId}/auth/factors`).reply(200, {
mock.onPost(`/user_management/users/${userId}/auth_factors`).reply(200, {
authentication_factor: {
object: 'authentication_factor',
id: 'auth_factor_1234',
Expand Down Expand Up @@ -410,7 +410,7 @@ describe('UserManagement', () => {
});

expect(mock.history.post[0].url).toEqual(
`/user_management/${userId}/auth/factors`,
`/user_management/users/${userId}/auth_factors`,
);
expect(resp).toMatchObject({
authenticationFactor: {
Expand Down
2 changes: 1 addition & 1 deletion src/user-management/user-management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export class UserManagement {
authentication_factor: FactorResponse;
authentication_challenge: ChallengeResponse;
}>(
`/user_management/${payload.userId}/auth/factors`,
`/user_management/users/${payload.userId}/auth_factors`,
serializeEnrollAuthFactorOptions(payload),
);

Expand Down

0 comments on commit 39dbc89

Please sign in to comment.