@outseta/api-client 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/generated/models/index.ts +1 -1
- package/src/generated/models/sendGridDomainAuthenticationAllOf.ts +2 -0
- package/src/generated/models/tokenPayload.ts +2 -0
- package/src/generated/models/twoFactorVerifyRequest.ts +25 -0
- package/src/generated/public/public.ts +16 -23
- package/src/generated/models/authVerifyTwoFactorTokenParams.ts +0 -8
package/package.json
CHANGED
|
@@ -103,7 +103,6 @@ export * from './authGetTokenParams';
|
|
|
103
103
|
export * from './authResendTwoFactorParams';
|
|
104
104
|
export * from './authSwitchTwoFactorMechanismParams';
|
|
105
105
|
export * from './authVerifyTwoFactorRecoveryParams';
|
|
106
|
-
export * from './authVerifyTwoFactorTokenParams';
|
|
107
106
|
export * from './backGroundTaskType';
|
|
108
107
|
export * from './billSettings';
|
|
109
108
|
export * from './billSettingsAllOf';
|
|
@@ -484,6 +483,7 @@ export * from './translationAllOf';
|
|
|
484
483
|
export * from './twoFactorChallengePayload';
|
|
485
484
|
export * from './twoFactorEnrollmentConfirmationPayload';
|
|
486
485
|
export * from './twoFactorTotpEnrollmentPayload';
|
|
486
|
+
export * from './twoFactorVerifyRequest';
|
|
487
487
|
export * from './usage';
|
|
488
488
|
export * from './usageAddUsageBody';
|
|
489
489
|
export * from './usageAllOf';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Request body for POST /api/v1/tokens/two-factor: the challenge token
|
|
5
|
+
from the login response plus the user's one-time code. Property names are
|
|
6
|
+
snake_case to match the wire format of the token endpoints.
|
|
7
|
+
|
|
8
|
+
The action binds the body as a loose JObject at runtime; this type
|
|
9
|
+
exists so the API docs describe the body instead of an opaque data
|
|
10
|
+
parameter (see [OpenApiRequestBody] on the action).
|
|
11
|
+
*/
|
|
12
|
+
export interface TwoFactorVerifyRequest {
|
|
13
|
+
/**
|
|
14
|
+
* The challenge_token returned by POST /api/v1/tokens when
|
|
15
|
+
two-factor authentication is required. Echo it back verbatim.
|
|
16
|
+
* @nullable
|
|
17
|
+
*/
|
|
18
|
+
challenge_token?: string | null;
|
|
19
|
+
/**
|
|
20
|
+
* The user's one-time code: the emailed code for an Email challenge,
|
|
21
|
+
or the current code from their authenticator app for a Totp challenge.
|
|
22
|
+
* @nullable
|
|
23
|
+
*/
|
|
24
|
+
code?: string | null;
|
|
25
|
+
}
|
|
@@ -4,7 +4,6 @@ import type {
|
|
|
4
4
|
AuthResendTwoFactorParams,
|
|
5
5
|
AuthSwitchTwoFactorMechanismParams,
|
|
6
6
|
AuthVerifyTwoFactorRecoveryParams,
|
|
7
|
-
AuthVerifyTwoFactorTokenParams,
|
|
8
7
|
TokenPayload,
|
|
9
8
|
TokenTwoFactorEnrollmentBeginEmailParams,
|
|
10
9
|
TokenTwoFactorEnrollmentBeginTotpParams,
|
|
@@ -12,7 +11,8 @@ import type {
|
|
|
12
11
|
TokenTwoFactorEnrollmentConfirmTotpParams,
|
|
13
12
|
TwoFactorChallengePayload,
|
|
14
13
|
TwoFactorEnrollmentConfirmationPayload,
|
|
15
|
-
TwoFactorTotpEnrollmentPayload
|
|
14
|
+
TwoFactorTotpEnrollmentPayload,
|
|
15
|
+
TwoFactorVerifyRequest
|
|
16
16
|
} from '.././models';
|
|
17
17
|
|
|
18
18
|
import { customFetch } from '../../client';
|
|
@@ -22,9 +22,9 @@ import { customFetch } from '../../client';
|
|
|
22
22
|
|
|
23
23
|
{ "username": "user@example.com", "password": "their-password" }
|
|
24
24
|
|
|
25
|
-
On success the response is `200` with an access token:
|
|
25
|
+
On success the response is `200` with an access token and refresh token:
|
|
26
26
|
|
|
27
|
-
{ "access_token": "eyJ...", "token_type": "Bearer", "expires_in": 31536000 }
|
|
27
|
+
{ "access_token": "eyJ...", "refresh_token": "...", "token_type": "Bearer", "expires_in": 31536000 }
|
|
28
28
|
|
|
29
29
|
**Two-factor authentication.** If the user has a verified 2FA method,
|
|
30
30
|
the password alone is not enough. After verifying the password this
|
|
@@ -117,13 +117,13 @@ authenticator app):
|
|
|
117
117
|
On success the response is `200` with the final access token, in the
|
|
118
118
|
same shape as `POST /api/v1/tokens`:
|
|
119
119
|
|
|
120
|
-
{ "access_token": "eyJ...", "token_type": "Bearer", "expires_in": 31536000 }
|
|
120
|
+
{ "access_token": "eyJ...", "refresh_token": "...", "token_type": "Bearer", "expires_in": 31536000 }
|
|
121
121
|
|
|
122
122
|
An incorrect code returns `400` (`invalid_grant`). A code has at most
|
|
123
123
|
five attempts before the challenge locks. An expired challenge returns
|
|
124
124
|
`410` (`challenge_expired`) — restart at `POST /api/v1/tokens`. The
|
|
125
125
|
endpoint is rate limited to 10 requests per minute (`429`).
|
|
126
|
-
* @summary Complete
|
|
126
|
+
* @summary Complete login when user has two-factor authentication enabled.
|
|
127
127
|
*/
|
|
128
128
|
export type authVerifyTwoFactorTokenResponse200 = {
|
|
129
129
|
data: TokenPayload
|
|
@@ -149,29 +149,23 @@ export type authVerifyTwoFactorTokenResponseError = (authVerifyTwoFactorTokenRes
|
|
|
149
149
|
|
|
150
150
|
export type authVerifyTwoFactorTokenResponse = (authVerifyTwoFactorTokenResponseSuccess | authVerifyTwoFactorTokenResponseError)
|
|
151
151
|
|
|
152
|
-
export const getAuthVerifyTwoFactorTokenUrl = (
|
|
153
|
-
const normalizedParams = new URLSearchParams();
|
|
152
|
+
export const getAuthVerifyTwoFactorTokenUrl = () => {
|
|
154
153
|
|
|
155
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
156
|
-
|
|
157
|
-
if (value !== undefined) {
|
|
158
|
-
normalizedParams.append(key, value === null ? 'null' : value.toString())
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
154
|
|
|
162
|
-
|
|
155
|
+
|
|
163
156
|
|
|
164
|
-
return
|
|
157
|
+
return `/api/v1/tokens/two-factor`
|
|
165
158
|
}
|
|
166
159
|
|
|
167
|
-
export const authVerifyTwoFactorToken = async (
|
|
160
|
+
export const authVerifyTwoFactorToken = async (twoFactorVerifyRequest: TwoFactorVerifyRequest, options?: RequestInit): Promise<authVerifyTwoFactorTokenResponse> => {
|
|
168
161
|
|
|
169
|
-
return customFetch<authVerifyTwoFactorTokenResponse>(getAuthVerifyTwoFactorTokenUrl(
|
|
162
|
+
return customFetch<authVerifyTwoFactorTokenResponse>(getAuthVerifyTwoFactorTokenUrl(),
|
|
170
163
|
{
|
|
171
164
|
...options,
|
|
172
|
-
method: 'POST'
|
|
173
|
-
|
|
174
|
-
|
|
165
|
+
method: 'POST',
|
|
166
|
+
headers: { 'Content-Type': 'application/json', ...options?.headers },
|
|
167
|
+
body: JSON.stringify(
|
|
168
|
+
twoFactorVerifyRequest,)
|
|
175
169
|
}
|
|
176
170
|
);}
|
|
177
171
|
|
|
@@ -319,8 +313,7 @@ requests per minute (`429`).
|
|
|
319
313
|
|
|
320
314
|
Used by the embed login widget; the hosted Razor flow has its own
|
|
321
315
|
equivalent action on the AuthenticationController.
|
|
322
|
-
* @summary Complete a two-factor
|
|
323
|
-
the primary one-time code, and obtain a JWT access token.
|
|
316
|
+
* @summary Complete login with a two-factor recovery code.
|
|
324
317
|
*/
|
|
325
318
|
export type authVerifyTwoFactorRecoveryResponse200 = {
|
|
326
319
|
data: TokenPayload
|