auth0 6.4.0 → 7.1.0
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/README.md +20 -15
- package/dist/cjs/index.d.ts +0 -2
- package/dist/cjs/index.js +0 -2
- package/dist/cjs/lib/errors.d.ts +0 -18
- package/dist/cjs/lib/errors.js +1 -25
- package/dist/cjs/lib/middleware/auth0-client-telemetry.d.ts +3 -7
- package/dist/cjs/lib/middleware/auth0-client-telemetry.js +1 -25
- package/dist/cjs/lib/models.d.ts +0 -24
- package/dist/cjs/lib/models.js +0 -53
- package/dist/cjs/management/Client.d.ts +5 -5
- package/dist/cjs/management/Client.js +28 -28
- package/dist/cjs/management/api/errors/GatewayTimeoutError.d.ts +5 -0
- package/dist/cjs/management/api/errors/GatewayTimeoutError.js +54 -0
- package/dist/cjs/management/api/errors/index.d.ts +1 -0
- package/dist/cjs/management/api/errors/index.js +1 -0
- package/dist/cjs/management/api/requests/requests.d.ts +112 -88
- package/dist/cjs/management/api/resources/experimentation/client/Client.d.ts +12 -0
- package/dist/cjs/management/api/resources/experimentation/client/Client.js +16 -0
- package/dist/cjs/management/api/resources/experimentation/exports.d.ts +3 -0
- package/dist/cjs/management/api/resources/experimentation/exports.js +22 -0
- package/dist/cjs/management/api/resources/experimentation/index.d.ts +2 -0
- package/dist/cjs/management/api/resources/experimentation/index.js +18 -0
- package/dist/cjs/management/api/resources/experimentation/resources/experiments/client/Client.d.ts +34 -0
- package/dist/cjs/management/api/resources/experimentation/resources/experiments/client/Client.js +131 -0
- package/dist/cjs/management/api/resources/experimentation/resources/experiments/client/index.js +2 -0
- package/dist/cjs/management/api/resources/experimentation/resources/experiments/exports.d.ts +2 -0
- package/dist/cjs/management/api/resources/{organizationTemplates → experimentation/resources/experiments}/exports.js +2 -2
- package/dist/cjs/management/api/resources/experimentation/resources/index.d.ts +1 -0
- package/dist/cjs/management/api/resources/experimentation/resources/index.js +37 -0
- package/dist/cjs/management/api/resources/guardian/client/Client.d.ts +40 -1
- package/dist/cjs/management/api/resources/guardian/client/Client.js +172 -0
- package/dist/cjs/management/api/resources/guardian/resources/factors/client/Client.d.ts +3 -0
- package/dist/cjs/management/api/resources/guardian/resources/factors/client/Client.js +11 -6
- package/dist/cjs/management/api/resources/guardian/resources/factors/resources/email/client/Client.d.ts +46 -0
- package/dist/cjs/management/api/resources/guardian/resources/factors/resources/email/client/Client.js +181 -0
- package/dist/cjs/management/api/resources/guardian/resources/factors/resources/email/client/index.js +2 -0
- package/dist/cjs/management/api/resources/guardian/resources/factors/resources/email/exports.d.ts +2 -0
- package/dist/cjs/management/api/resources/guardian/resources/factors/resources/email/exports.js +21 -0
- package/dist/cjs/management/api/resources/guardian/resources/factors/resources/email/index.d.ts +1 -0
- package/dist/cjs/{lib → management/api/resources/guardian/resources/factors/resources/email}/index.js +1 -2
- package/dist/cjs/management/api/resources/guardian/resources/factors/resources/index.d.ts +1 -0
- package/dist/cjs/management/api/resources/guardian/resources/factors/resources/index.js +2 -1
- package/dist/cjs/management/api/resources/guardian/resources/factors/resources/phone/client/Client.d.ts +33 -0
- package/dist/cjs/management/api/resources/guardian/resources/factors/resources/phone/client/Client.js +122 -0
- package/dist/cjs/management/api/resources/index.d.ts +1 -1
- package/dist/cjs/management/api/resources/index.js +2 -2
- package/dist/cjs/management/api/resources/organizations/client/Client.d.ts +36 -0
- package/dist/cjs/management/api/resources/organizations/client/Client.js +104 -0
- package/dist/cjs/management/api/resources/resourceServers/client/Client.d.ts +29 -0
- package/dist/cjs/management/api/resources/resourceServers/client/Client.js +103 -0
- package/dist/cjs/management/api/types/types.d.ts +226 -51
- package/dist/cjs/management/api/types/types.js +37 -36
- package/dist/cjs/management/version.d.ts +1 -1
- package/dist/cjs/management/version.js +1 -1
- package/dist/cjs/management/wrapper/ManagementClient.d.ts +9 -2
- package/dist/cjs/management/wrapper/ManagementClient.js +0 -1
- package/dist/cjs/management/wrapper/token-provider.d.ts +4 -2
- package/dist/cjs/management/wrapper/token-provider.js +142 -11
- package/dist/cjs/utils.d.ts +0 -18
- package/dist/cjs/utils.js +1 -32
- package/dist/esm/index.d.mts +0 -2
- package/dist/esm/index.mjs +0 -2
- package/dist/esm/lib/errors.d.mts +0 -18
- package/dist/esm/lib/errors.mjs +0 -22
- package/dist/esm/lib/middleware/auth0-client-telemetry.d.mts +3 -7
- package/dist/esm/lib/middleware/auth0-client-telemetry.mjs +1 -25
- package/dist/esm/lib/models.d.mts +0 -24
- package/dist/esm/lib/models.mjs +1 -49
- package/dist/esm/management/Client.d.mts +5 -5
- package/dist/esm/management/Client.mjs +7 -7
- package/dist/esm/management/api/errors/GatewayTimeoutError.d.mts +5 -0
- package/dist/esm/management/api/errors/GatewayTimeoutError.mjs +17 -0
- package/dist/esm/management/api/errors/index.d.mts +1 -0
- package/dist/esm/management/api/errors/index.mjs +1 -0
- package/dist/esm/management/api/requests/requests.d.mts +112 -88
- package/dist/esm/management/api/resources/experimentation/client/Client.d.mts +12 -0
- package/dist/esm/management/api/resources/experimentation/client/Client.mjs +12 -0
- package/dist/esm/management/api/resources/experimentation/client/index.d.mts +1 -0
- package/dist/esm/management/api/resources/experimentation/client/index.mjs +1 -0
- package/dist/esm/management/api/resources/experimentation/exports.d.mts +3 -0
- package/dist/esm/management/api/resources/experimentation/exports.mjs +4 -0
- package/dist/esm/management/api/resources/experimentation/index.d.mts +2 -0
- package/dist/esm/management/api/resources/experimentation/index.mjs +2 -0
- package/dist/esm/management/api/resources/experimentation/resources/experiments/client/Client.d.mts +34 -0
- package/dist/esm/management/api/resources/experimentation/resources/experiments/client/Client.mjs +94 -0
- package/dist/esm/management/api/resources/experimentation/resources/experiments/client/index.d.mts +1 -0
- package/dist/esm/management/api/resources/experimentation/resources/experiments/client/index.mjs +1 -0
- package/dist/esm/management/api/resources/experimentation/resources/experiments/exports.d.mts +2 -0
- package/dist/esm/management/api/resources/{organizationTemplates → experimentation/resources/experiments}/exports.mjs +1 -1
- package/dist/esm/management/api/resources/experimentation/resources/index.d.mts +1 -0
- package/dist/esm/management/api/resources/experimentation/resources/index.mjs +1 -0
- package/dist/esm/management/api/resources/guardian/client/Client.d.mts +40 -1
- package/dist/esm/management/api/resources/guardian/client/Client.mjs +139 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/client/Client.d.mts +3 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/client/Client.mjs +5 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/resources/email/client/Client.d.mts +46 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/resources/email/client/Client.mjs +144 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/resources/email/client/index.d.mts +1 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/resources/email/client/index.mjs +1 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/resources/email/exports.d.mts +2 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/resources/email/exports.mjs +3 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/resources/email/index.d.mts +1 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/resources/email/index.mjs +1 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/resources/index.d.mts +1 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/resources/index.mjs +1 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/resources/phone/client/Client.d.mts +33 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/resources/phone/client/Client.mjs +122 -0
- package/dist/esm/management/api/resources/index.d.mts +1 -1
- package/dist/esm/management/api/resources/index.mjs +1 -1
- package/dist/esm/management/api/resources/organizations/client/Client.d.mts +36 -0
- package/dist/esm/management/api/resources/organizations/client/Client.mjs +104 -0
- package/dist/esm/management/api/resources/resourceServers/client/Client.d.mts +29 -0
- package/dist/esm/management/api/resources/resourceServers/client/Client.mjs +103 -0
- package/dist/esm/management/api/types/types.d.mts +226 -51
- package/dist/esm/management/api/types/types.mjs +34 -33
- package/dist/esm/management/version.d.mts +1 -1
- package/dist/esm/management/version.mjs +1 -1
- package/dist/esm/management/wrapper/ManagementClient.d.mts +9 -2
- package/dist/esm/management/wrapper/ManagementClient.mjs +0 -1
- package/dist/esm/management/wrapper/token-provider.d.mts +4 -2
- package/dist/esm/management/wrapper/token-provider.mjs +142 -11
- package/dist/esm/utils.d.mts +0 -18
- package/dist/esm/utils.mjs +0 -30
- package/package.json +45 -23
- package/reference.md +654 -389
- package/dist/cjs/auth/backchannel.d.ts +0 -158
- package/dist/cjs/auth/backchannel.js +0 -135
- package/dist/cjs/auth/base-auth-api.d.ts +0 -41
- package/dist/cjs/auth/base-auth-api.js +0 -109
- package/dist/cjs/auth/client-authentication.d.ts +0 -27
- package/dist/cjs/auth/client-authentication.js +0 -82
- package/dist/cjs/auth/database.d.ts +0 -157
- package/dist/cjs/auth/database.js +0 -94
- package/dist/cjs/auth/id-token-validator.d.ts +0 -18
- package/dist/cjs/auth/id-token-validator.js +0 -158
- package/dist/cjs/auth/index.d.ts +0 -65
- package/dist/cjs/auth/index.js +0 -80
- package/dist/cjs/auth/oauth.d.ts +0 -462
- package/dist/cjs/auth/oauth.js +0 -280
- package/dist/cjs/auth/passwordless.d.ts +0 -165
- package/dist/cjs/auth/passwordless.js +0 -173
- package/dist/cjs/auth/tokenExchange.d.ts +0 -166
- package/dist/cjs/auth/tokenExchange.js +0 -74
- package/dist/cjs/lib/index.d.ts +0 -3
- package/dist/cjs/lib/runtime.d.ts +0 -61
- package/dist/cjs/lib/runtime.js +0 -222
- package/dist/cjs/management/api/resources/organizationTemplates/client/Client.d.ts +0 -106
- package/dist/cjs/management/api/resources/organizationTemplates/client/Client.js +0 -411
- package/dist/cjs/management/api/resources/organizationTemplates/exports.d.ts +0 -2
- package/dist/cjs/userinfo/index.d.ts +0 -87
- package/dist/cjs/userinfo/index.js +0 -104
- package/dist/esm/auth/backchannel.d.mts +0 -158
- package/dist/esm/auth/backchannel.mjs +0 -131
- package/dist/esm/auth/base-auth-api.d.mts +0 -41
- package/dist/esm/auth/base-auth-api.mjs +0 -103
- package/dist/esm/auth/client-authentication.d.mts +0 -27
- package/dist/esm/auth/client-authentication.mjs +0 -45
- package/dist/esm/auth/database.d.mts +0 -157
- package/dist/esm/auth/database.mjs +0 -90
- package/dist/esm/auth/id-token-validator.d.mts +0 -18
- package/dist/esm/auth/id-token-validator.mjs +0 -120
- package/dist/esm/auth/index.d.mts +0 -65
- package/dist/esm/auth/index.mjs +0 -60
- package/dist/esm/auth/oauth.d.mts +0 -462
- package/dist/esm/auth/oauth.mjs +0 -276
- package/dist/esm/auth/passwordless.d.mts +0 -165
- package/dist/esm/auth/passwordless.mjs +0 -169
- package/dist/esm/auth/tokenExchange.d.mts +0 -166
- package/dist/esm/auth/tokenExchange.mjs +0 -70
- package/dist/esm/lib/index.d.mts +0 -3
- package/dist/esm/lib/index.mjs +0 -2
- package/dist/esm/lib/runtime.d.mts +0 -61
- package/dist/esm/lib/runtime.mjs +0 -201
- package/dist/esm/management/api/resources/organizationTemplates/client/Client.d.mts +0 -106
- package/dist/esm/management/api/resources/organizationTemplates/client/Client.mjs +0 -374
- package/dist/esm/management/api/resources/organizationTemplates/exports.d.mts +0 -2
- package/dist/esm/userinfo/index.d.mts +0 -87
- package/dist/esm/userinfo/index.mjs +0 -98
- /package/dist/cjs/management/api/resources/{organizationTemplates → experimentation}/client/index.d.ts +0 -0
- /package/dist/cjs/management/api/resources/{organizationTemplates → experimentation}/client/index.js +0 -0
- /package/dist/{esm/management/api/resources/organizationTemplates/client/index.d.mts → cjs/management/api/resources/experimentation/resources/experiments/client/index.d.ts} +0 -0
- /package/dist/cjs/management/api/resources/{organizationTemplates → experimentation/resources/experiments}/index.d.ts +0 -0
- /package/dist/cjs/management/api/resources/{organizationTemplates → experimentation/resources/experiments}/index.js +0 -0
- /package/dist/{esm/management/api/resources/organizationTemplates/client/index.mjs → cjs/management/api/resources/guardian/resources/factors/resources/email/client/index.d.ts} +0 -0
- /package/dist/esm/management/api/resources/{organizationTemplates → experimentation/resources/experiments}/index.d.mts +0 -0
- /package/dist/esm/management/api/resources/{organizationTemplates → experimentation/resources/experiments}/index.mjs +0 -0
package/dist/esm/auth/oauth.mjs
DELETED
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { JSONApiResponse, VoidApiResponse, validateRequiredRequestParams } from "../lib/runtime.mjs";
|
|
11
|
-
import { BaseAuthAPI, grant } from "./base-auth-api.mjs";
|
|
12
|
-
import { IDTokenValidator } from "./id-token-validator.mjs";
|
|
13
|
-
import { mtlsPrefix } from "../utils.mjs";
|
|
14
|
-
export var SUBJECT_TOKEN_TYPES;
|
|
15
|
-
(function (SUBJECT_TOKEN_TYPES) {
|
|
16
|
-
/**
|
|
17
|
-
* Constant representing the subject type for a refresh token.
|
|
18
|
-
* This is used in OAuth 2.0 token exchange to specify that the token being exchanged is a refresh token.
|
|
19
|
-
*
|
|
20
|
-
* @see {@link https://tools.ietf.org/html/rfc8693#section-3.1 RFC 8693 Section 3.1}
|
|
21
|
-
*/
|
|
22
|
-
SUBJECT_TOKEN_TYPES["REFRESH_TOKEN"] = "urn:ietf:params:oauth:token-type:refresh_token";
|
|
23
|
-
/**
|
|
24
|
-
* Constant representing the subject type for a access token.
|
|
25
|
-
* This is used in OAuth 2.0 token exchange to specify that the token being exchanged is an access token.
|
|
26
|
-
*
|
|
27
|
-
* @see {@link https://tools.ietf.org/html/rfc8693#section-3.1 RFC 8693 Section 3.1}
|
|
28
|
-
*/
|
|
29
|
-
SUBJECT_TOKEN_TYPES["ACCESS_TOKEN"] = "urn:ietf:params:oauth:token-type:access_token";
|
|
30
|
-
})(SUBJECT_TOKEN_TYPES || (SUBJECT_TOKEN_TYPES = {}));
|
|
31
|
-
export const TOKEN_FOR_CONNECTION_GRANT_TYPE = "urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token";
|
|
32
|
-
/**
|
|
33
|
-
* @deprecated Use {@link SUBJECT_TOKEN_TYPES.REFRESH_TOKEN} instead.
|
|
34
|
-
*/
|
|
35
|
-
export const TOKEN_FOR_CONNECTION_TOKEN_TYPE = "urn:ietf:params:oauth:token-type:refresh_token";
|
|
36
|
-
export const TOKEN_FOR_CONNECTION_REQUESTED_TOKEN_TYPE = "http://auth0.com/oauth/token-type/federated-connection-access-token";
|
|
37
|
-
export const TOKEN_URL = "/oauth/token";
|
|
38
|
-
/**
|
|
39
|
-
* OAuth 2.0 flows.
|
|
40
|
-
*/
|
|
41
|
-
export class OAuth extends BaseAuthAPI {
|
|
42
|
-
constructor(options) {
|
|
43
|
-
super(Object.assign(Object.assign({}, options), { domain: options.useMTLS ? `${mtlsPrefix}.${options.domain}` : options.domain }));
|
|
44
|
-
this.idTokenValidator = new IDTokenValidator(options);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* This is the flow that regular web apps use to access an API.
|
|
48
|
-
*
|
|
49
|
-
* Use this endpoint to exchange an Authorization Code for a Token.
|
|
50
|
-
*
|
|
51
|
-
* See: https://auth0.com/docs/api/authentication#authorization-code-flow44
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```js
|
|
55
|
-
* const auth0 = new AuthenticationApi({
|
|
56
|
-
* domain: 'my-domain.auth0.com',
|
|
57
|
-
* clientId: 'myClientId',
|
|
58
|
-
* clientSecret: 'myClientSecret'
|
|
59
|
-
* });
|
|
60
|
-
*
|
|
61
|
-
* await auth0.oauth.authorizationCodeGrant({ code: 'mycode' });
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
authorizationCodeGrant(bodyParameters_1) {
|
|
65
|
-
return __awaiter(this, arguments, void 0, function* (bodyParameters, options = {}) {
|
|
66
|
-
validateRequiredRequestParams(bodyParameters, ["code"]);
|
|
67
|
-
return grant("authorization_code", yield this.addClientAuthentication(bodyParameters), options, this.clientId, this.idTokenValidator, this.request.bind(this));
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* PKCE was originally designed to protect the authorization code flow in mobile apps,
|
|
72
|
-
* but its ability to prevent authorization code injection makes it useful for every type of OAuth client,
|
|
73
|
-
* even web apps that use client authentication.
|
|
74
|
-
*
|
|
75
|
-
* See: https://auth0.com/docs/api/authentication#authorization-code-flow-with-pkce45
|
|
76
|
-
*
|
|
77
|
-
* @example
|
|
78
|
-
* ```js
|
|
79
|
-
* const auth0 = new AuthenticationApi({
|
|
80
|
-
* domain: 'my-domain.auth0.com',
|
|
81
|
-
* clientId: 'myClientId',
|
|
82
|
-
* clientSecret: 'myClientSecret'
|
|
83
|
-
* });
|
|
84
|
-
*
|
|
85
|
-
* await auth0.oauth.authorizationCodeGrantWithPKCE({
|
|
86
|
-
* code: 'mycode',
|
|
87
|
-
* code_verifier: 'mycodeverifier'
|
|
88
|
-
* });
|
|
89
|
-
* ```
|
|
90
|
-
*/
|
|
91
|
-
authorizationCodeGrantWithPKCE(bodyParameters_1) {
|
|
92
|
-
return __awaiter(this, arguments, void 0, function* (bodyParameters, options = {}) {
|
|
93
|
-
validateRequiredRequestParams(bodyParameters, ["code", "code_verifier"]);
|
|
94
|
-
return grant("authorization_code", yield this.addClientAuthentication(bodyParameters), options, this.clientId, this.idTokenValidator, this.request.bind(this));
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* This is the OAuth 2.0 grant that server processes use to access an API.
|
|
99
|
-
*
|
|
100
|
-
* Use this endpoint to directly request an Access Token by using the Client's credentials
|
|
101
|
-
* (a Client ID and a Client Secret or a Client Assertion).
|
|
102
|
-
*
|
|
103
|
-
* See: https://auth0.com/docs/api/authentication#client-credentials-flow
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* ```js
|
|
107
|
-
* const auth0 = new AuthenticationApi({
|
|
108
|
-
* domain: 'my-domain.auth0.com',
|
|
109
|
-
* clientId: 'myClientId',
|
|
110
|
-
* clientSecret: 'myClientSecret'
|
|
111
|
-
* });
|
|
112
|
-
*
|
|
113
|
-
* await auth0.oauth.clientCredentialsGrant({ audience: 'myaudience' });
|
|
114
|
-
* ```
|
|
115
|
-
*/
|
|
116
|
-
clientCredentialsGrant(bodyParameters_1) {
|
|
117
|
-
return __awaiter(this, arguments, void 0, function* (bodyParameters, options = {}) {
|
|
118
|
-
validateRequiredRequestParams(bodyParameters, ["audience"]);
|
|
119
|
-
return grant("client_credentials", yield this.addClientAuthentication(bodyParameters), options, this.clientId, this.idTokenValidator, this.request.bind(this));
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* This is the OAuth 2.0 extension that allows to initiate an OAuth flow from the backchannel instead of by building a URL.
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
* See: https://www.rfc-editor.org/rfc/rfc9126.html
|
|
127
|
-
*
|
|
128
|
-
* @example
|
|
129
|
-
* ```js
|
|
130
|
-
* const auth0 = new AuthenticationApi({
|
|
131
|
-
* domain: 'my-domain.auth0.com',
|
|
132
|
-
* clientId: 'myClientId',
|
|
133
|
-
* clientSecret: 'myClientSecret'
|
|
134
|
-
* });
|
|
135
|
-
*
|
|
136
|
-
* await auth0.oauth.pushedAuthorization({ response_type: 'id_token', redirect_uri: 'http://localhost' });
|
|
137
|
-
* ```
|
|
138
|
-
*/
|
|
139
|
-
pushedAuthorization(bodyParameters_1) {
|
|
140
|
-
return __awaiter(this, arguments, void 0, function* (bodyParameters, options = {}) {
|
|
141
|
-
validateRequiredRequestParams(bodyParameters, ["client_id", "response_type", "redirect_uri"]);
|
|
142
|
-
const bodyParametersWithClientAuthentication = yield this.addClientAuthentication(bodyParameters);
|
|
143
|
-
const response = yield this.request({
|
|
144
|
-
path: "/oauth/par",
|
|
145
|
-
method: "POST",
|
|
146
|
-
headers: {
|
|
147
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
148
|
-
},
|
|
149
|
-
body: new URLSearchParams(Object.assign({ client_id: this.clientId }, bodyParametersWithClientAuthentication)),
|
|
150
|
-
}, options.initOverrides);
|
|
151
|
-
return JSONApiResponse.fromResponse(response);
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* This information is typically received from a highly trusted public client like a SPA*.
|
|
156
|
-
* (<strong>*Note:</string> For single-page applications and native/mobile apps, we recommend using web flows instead.)
|
|
157
|
-
*
|
|
158
|
-
* See: https://auth0.com/docs/api/authentication#resource-owner-password
|
|
159
|
-
*
|
|
160
|
-
* @example
|
|
161
|
-
* ```js
|
|
162
|
-
* const auth0 = new AuthenticationApi({
|
|
163
|
-
* domain: 'my-domain.auth0.com',
|
|
164
|
-
* clientId: 'myClientId'
|
|
165
|
-
* clientSecret: 'myClientSecret'
|
|
166
|
-
* });
|
|
167
|
-
*
|
|
168
|
-
* await auth0.oauth.passwordGrant({
|
|
169
|
-
* username: 'myusername@example.com',
|
|
170
|
-
* password: 'mypassword'
|
|
171
|
-
* },
|
|
172
|
-
* { initOverrides: { headers: { 'auth0-forwarded-for': 'END.USER.IP.123' } } }
|
|
173
|
-
* );
|
|
174
|
-
* ```
|
|
175
|
-
*
|
|
176
|
-
* Set the'auth0-forwarded-for' header to the end-user IP as a string value if you want
|
|
177
|
-
* brute-force protection to work in server-side scenarios.
|
|
178
|
-
*
|
|
179
|
-
* See https://auth0.com/docs/get-started/authentication-and-authorization-flow/avoid-common-issues-with-resource-owner-password-flow-and-attack-protection
|
|
180
|
-
*
|
|
181
|
-
*/
|
|
182
|
-
passwordGrant(bodyParameters_1) {
|
|
183
|
-
return __awaiter(this, arguments, void 0, function* (bodyParameters, options = {}) {
|
|
184
|
-
validateRequiredRequestParams(bodyParameters, ["username", "password"]);
|
|
185
|
-
return grant(bodyParameters.realm ? "http://auth0.com/oauth/grant-type/password-realm" : "password", yield this.addClientAuthentication(bodyParameters), options, this.clientId, this.idTokenValidator, this.request.bind(this));
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Use this endpoint to refresh an Access Token using the Refresh Token you got during authorization.
|
|
190
|
-
*
|
|
191
|
-
* See: https://auth0.com/docs/api/authentication#refresh-token
|
|
192
|
-
*
|
|
193
|
-
* @example
|
|
194
|
-
* ```js
|
|
195
|
-
* const auth0 = new AuthenticationApi({
|
|
196
|
-
* domain: 'my-domain.auth0.com',
|
|
197
|
-
* clientId: 'myClientId'
|
|
198
|
-
* clientSecret: 'myClientSecret'
|
|
199
|
-
* });
|
|
200
|
-
*
|
|
201
|
-
* await auth0.oauth.refreshTokenGrant({ refresh_token: 'myrefreshtoken' })
|
|
202
|
-
* ```
|
|
203
|
-
*/
|
|
204
|
-
refreshTokenGrant(bodyParameters_1) {
|
|
205
|
-
return __awaiter(this, arguments, void 0, function* (bodyParameters, options = {}) {
|
|
206
|
-
validateRequiredRequestParams(bodyParameters, ["refresh_token"]);
|
|
207
|
-
return grant("refresh_token", yield this.addClientAuthentication(bodyParameters), options, this.clientId, this.idTokenValidator, this.request.bind(this));
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Use this endpoint to invalidate a Refresh Token if it has been compromised.
|
|
212
|
-
*
|
|
213
|
-
* The behaviour of this endpoint depends on the state of the <a href="https://auth0.com/docs/secure/tokens/refresh-tokens/revoke-refresh-tokens#refresh-tokens-and-grants">Refresh Token Revocation Deletes Grant</a> toggle.
|
|
214
|
-
* If this toggle is enabled, then each revocation request invalidates not only the specific token, but all other tokens based on the same authorization grant.
|
|
215
|
-
* This means that all Refresh Tokens that have been issued for the same user, application, and audience will be revoked.
|
|
216
|
-
* If this toggle is disabled, then only the refresh token is revoked, while the grant is left intact.
|
|
217
|
-
*
|
|
218
|
-
* See: https://auth0.com/docs/api/authentication#revoke-refresh-token
|
|
219
|
-
*
|
|
220
|
-
* @example
|
|
221
|
-
* ```js
|
|
222
|
-
* const auth0 = new AuthenticationApi({
|
|
223
|
-
* domain: 'my-domain.auth0.com',
|
|
224
|
-
* clientId: 'myClientId'
|
|
225
|
-
* clientSecret: 'myClientSecret'
|
|
226
|
-
* });
|
|
227
|
-
*
|
|
228
|
-
* await auth0.oauth.revokeRefreshToken({ token: 'myrefreshtoken' })
|
|
229
|
-
* ```
|
|
230
|
-
*/
|
|
231
|
-
revokeRefreshToken(bodyParameters_1) {
|
|
232
|
-
return __awaiter(this, arguments, void 0, function* (bodyParameters, options = {}) {
|
|
233
|
-
validateRequiredRequestParams(bodyParameters, ["token"]);
|
|
234
|
-
const response = yield this.request({
|
|
235
|
-
path: "/oauth/revoke",
|
|
236
|
-
method: "POST",
|
|
237
|
-
headers: {
|
|
238
|
-
"Content-Type": "application/json",
|
|
239
|
-
},
|
|
240
|
-
body: yield this.addClientAuthentication(Object.assign({ client_id: this.clientId }, bodyParameters)),
|
|
241
|
-
}, options.initOverrides);
|
|
242
|
-
return VoidApiResponse.fromResponse(response);
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Exchanges a subject token for an access token for the connection.
|
|
247
|
-
*
|
|
248
|
-
* The request body includes:
|
|
249
|
-
* - client_id (and client_secret/client_assertion via addClientAuthentication)
|
|
250
|
-
* - grant_type set to `urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token`
|
|
251
|
-
* - subject_token: the token to exchange
|
|
252
|
-
* - subject_token_type: the type of token being exchanged. Defaults to refresh tokens (`urn:ietf:params:oauth:token-type:refresh_token`).
|
|
253
|
-
* - requested_token_type (`http://auth0.com/oauth/token-type/federated-connection-access-token`) indicating that a federated connection access token is desired
|
|
254
|
-
* - connection name and an optional `login_hint` if provided
|
|
255
|
-
*
|
|
256
|
-
* @param bodyParameters - The options to retrieve a token for a connection.
|
|
257
|
-
* @returns A promise with the token response data.
|
|
258
|
-
* @throws An error if the exchange fails.
|
|
259
|
-
*/
|
|
260
|
-
tokenForConnection(bodyParameters_1) {
|
|
261
|
-
return __awaiter(this, arguments, void 0, function* (bodyParameters, options = {}) {
|
|
262
|
-
validateRequiredRequestParams(bodyParameters, ["connection", "subject_token"]);
|
|
263
|
-
const body = Object.assign(Object.assign({ subject_token_type: SUBJECT_TOKEN_TYPES.REFRESH_TOKEN }, bodyParameters), { grant_type: TOKEN_FOR_CONNECTION_GRANT_TYPE, requested_token_type: TOKEN_FOR_CONNECTION_REQUESTED_TOKEN_TYPE });
|
|
264
|
-
yield this.addClientAuthentication(body);
|
|
265
|
-
const response = yield this.request({
|
|
266
|
-
path: TOKEN_URL,
|
|
267
|
-
method: "POST",
|
|
268
|
-
headers: {
|
|
269
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
270
|
-
},
|
|
271
|
-
body: new URLSearchParams(body),
|
|
272
|
-
}, options.initOverrides);
|
|
273
|
-
return JSONApiResponse.fromResponse(response);
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
}
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { InitOverride, JSONApiResponse, VoidApiResponse } from "../lib/runtime.mjs";
|
|
2
|
-
import { BaseAuthAPI, AuthenticationClientOptions } from "./base-auth-api.mjs";
|
|
3
|
-
import { ClientCredentials, GrantOptions, TokenSet } from "./oauth.mjs";
|
|
4
|
-
export interface SendEmailLinkRequest {
|
|
5
|
-
/**
|
|
6
|
-
* The user's email address
|
|
7
|
-
*/
|
|
8
|
-
email: string;
|
|
9
|
-
/**
|
|
10
|
-
* Use `link` to send a link or `code` to send a verification code.
|
|
11
|
-
* If omitted, a `link` will be sent.
|
|
12
|
-
*/
|
|
13
|
-
send?: "link";
|
|
14
|
-
/**
|
|
15
|
-
* Append or override the link parameters (like `scope`, `redirect_uri`, `protocol`, `response_type`),
|
|
16
|
-
* when you send a link using email.
|
|
17
|
-
*/
|
|
18
|
-
authParams?: Record<string, unknown>;
|
|
19
|
-
}
|
|
20
|
-
export interface SendEmailCodeRequest {
|
|
21
|
-
/**
|
|
22
|
-
* The user's email address
|
|
23
|
-
*/
|
|
24
|
-
email: string;
|
|
25
|
-
/**
|
|
26
|
-
* Use `link` to send a link or `code` to send a verification code.
|
|
27
|
-
* If omitted, a `link` will be sent.
|
|
28
|
-
*/
|
|
29
|
-
send?: "code";
|
|
30
|
-
}
|
|
31
|
-
export type SendEmailRequest = SendEmailLinkRequest | SendEmailCodeRequest;
|
|
32
|
-
export interface SendSmsRequest {
|
|
33
|
-
/**
|
|
34
|
-
* The users phone number.
|
|
35
|
-
*/
|
|
36
|
-
phone_number: string;
|
|
37
|
-
}
|
|
38
|
-
export interface LoginWithEmailRequest extends ClientCredentials {
|
|
39
|
-
/**
|
|
40
|
-
* The user's email address.
|
|
41
|
-
*/
|
|
42
|
-
email: string;
|
|
43
|
-
/**
|
|
44
|
-
* The user's verification code.
|
|
45
|
-
*/
|
|
46
|
-
code: string;
|
|
47
|
-
/**
|
|
48
|
-
* API Identifier of the API for which you want to get an Access Token.
|
|
49
|
-
*/
|
|
50
|
-
audience?: string;
|
|
51
|
-
/**
|
|
52
|
-
* Use openid to get an ID Token, or openid profile email to also include user profile information in the ID Token.
|
|
53
|
-
*/
|
|
54
|
-
scope?: string;
|
|
55
|
-
}
|
|
56
|
-
export interface LoginWithSMSRequest extends Omit<LoginWithEmailRequest, "email"> {
|
|
57
|
-
/**
|
|
58
|
-
* The user's phone number.
|
|
59
|
-
*/
|
|
60
|
-
phone_number: string;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Handles passwordless flows using Email and SMS.
|
|
64
|
-
*/
|
|
65
|
-
export declare class Passwordless extends BaseAuthAPI {
|
|
66
|
-
private idTokenValidator;
|
|
67
|
-
constructor(configuration: AuthenticationClientOptions);
|
|
68
|
-
/**
|
|
69
|
-
* Start passwordless flow sending an email.
|
|
70
|
-
*
|
|
71
|
-
* Given the user `email` address, it will send an email with:
|
|
72
|
-
*
|
|
73
|
-
* <ul>
|
|
74
|
-
* <li>A link (default, `send:"link"`). You can then authenticate with this
|
|
75
|
-
* user opening the link and he will be automatically logged in to the
|
|
76
|
-
* application. Optionally, you can append/override parameters to the link
|
|
77
|
-
* (like `scope`, `redirect_uri`, `protocol`, `response_type`, etc.) using
|
|
78
|
-
* `authParams` object.
|
|
79
|
-
* </li>
|
|
80
|
-
* <li>
|
|
81
|
-
* A verification code (`send:"code"`). You can then authenticate with
|
|
82
|
-
* this user using the `/oauth/token` endpoint specifying `email` as
|
|
83
|
-
* `username` and `code` as `password`.
|
|
84
|
-
* </li>
|
|
85
|
-
* </ul>
|
|
86
|
-
*
|
|
87
|
-
* See: https://auth0.com/docs/api/authentication#get-code-or-link
|
|
88
|
-
*
|
|
89
|
-
* @example
|
|
90
|
-
* ```js
|
|
91
|
-
* const auth0 = new AuthenticationApi({
|
|
92
|
-
* domain: 'my-domain.auth0.com',
|
|
93
|
-
* clientId: 'myClientId',
|
|
94
|
-
* clientSecret: 'myClientSecret'
|
|
95
|
-
* });
|
|
96
|
-
*
|
|
97
|
-
* await auth0.passwordless.sendEmail({
|
|
98
|
-
* email: '{EMAIL}',
|
|
99
|
-
* send: 'link',
|
|
100
|
-
* authParams: {} // Optional auth params.
|
|
101
|
-
* });
|
|
102
|
-
* ```
|
|
103
|
-
*/
|
|
104
|
-
sendEmail(bodyParameters: SendEmailRequest, initOverrides?: InitOverride): Promise<VoidApiResponse>;
|
|
105
|
-
/**
|
|
106
|
-
* Start passwordless flow sending an SMS.
|
|
107
|
-
*
|
|
108
|
-
* Given the user `phone_number`, it will send a SMS message with a
|
|
109
|
-
* verification code. You can then authenticate with this user using the
|
|
110
|
-
* `/oauth/token` endpoint specifying `phone_number` as `username` and `code` as
|
|
111
|
-
* `password`:
|
|
112
|
-
*
|
|
113
|
-
* See: https://auth0.com/docs/api/authentication#get-code-or-link
|
|
114
|
-
*
|
|
115
|
-
* @example
|
|
116
|
-
* ```js
|
|
117
|
-
* const auth0 = new AuthenticationApi({
|
|
118
|
-
* domain: 'my-domain.auth0.com',
|
|
119
|
-
* clientId: 'myClientId',
|
|
120
|
-
* clientSecret: 'myClientSecret'
|
|
121
|
-
* });
|
|
122
|
-
*
|
|
123
|
-
* await auth0.passwordless.sendSMS({
|
|
124
|
-
* phone_number: '{PHONE}'
|
|
125
|
-
* });
|
|
126
|
-
* ```
|
|
127
|
-
*/
|
|
128
|
-
sendSMS(bodyParameters: SendSmsRequest, initOverrides?: InitOverride): Promise<VoidApiResponse>;
|
|
129
|
-
/**
|
|
130
|
-
* Once you have a verification code, use this endpoint to login the user with their email and verification code.
|
|
131
|
-
*
|
|
132
|
-
* @example
|
|
133
|
-
* ```js
|
|
134
|
-
* const auth0 = new AuthenticationApi({
|
|
135
|
-
* domain: 'my-domain.auth0.com',
|
|
136
|
-
* clientId: 'myClientId',
|
|
137
|
-
* clientSecret: 'myClientSecret'
|
|
138
|
-
* });
|
|
139
|
-
*
|
|
140
|
-
* await auth0.passwordless.loginWithEmail({
|
|
141
|
-
* email: 'foo@example.com',
|
|
142
|
-
* code: 'ABC123'
|
|
143
|
-
* });
|
|
144
|
-
* ```
|
|
145
|
-
*/
|
|
146
|
-
loginWithEmail(bodyParameters: LoginWithEmailRequest, options?: GrantOptions): Promise<JSONApiResponse<TokenSet>>;
|
|
147
|
-
/**
|
|
148
|
-
* Once you have a verification code, use this endpoint to login the user with their phone number and verification code.
|
|
149
|
-
*
|
|
150
|
-
* @example
|
|
151
|
-
* ```js
|
|
152
|
-
* const auth0 = new AuthenticationApi({
|
|
153
|
-
* domain: 'my-domain.auth0.com',
|
|
154
|
-
* clientId: 'myClientId',
|
|
155
|
-
* clientSecret: 'myClientSecret'
|
|
156
|
-
* });
|
|
157
|
-
*
|
|
158
|
-
* await auth0.passwordless.loginWithSMS({
|
|
159
|
-
* phone_number: '0777777777',
|
|
160
|
-
* code: 'ABC123'
|
|
161
|
-
* });
|
|
162
|
-
* ```
|
|
163
|
-
*/
|
|
164
|
-
loginWithSMS(bodyParameters: LoginWithSMSRequest, options?: GrantOptions): Promise<JSONApiResponse<TokenSet>>;
|
|
165
|
-
}
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
-
var t = {};
|
|
12
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
-
t[p] = s[p];
|
|
14
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
-
t[p[i]] = s[p[i]];
|
|
18
|
-
}
|
|
19
|
-
return t;
|
|
20
|
-
};
|
|
21
|
-
import { VoidApiResponse, validateRequiredRequestParams } from "../lib/runtime.mjs";
|
|
22
|
-
import { BaseAuthAPI, grant } from "./base-auth-api.mjs";
|
|
23
|
-
import { IDTokenValidator } from "./id-token-validator.mjs";
|
|
24
|
-
/**
|
|
25
|
-
* Handles passwordless flows using Email and SMS.
|
|
26
|
-
*/
|
|
27
|
-
export class Passwordless extends BaseAuthAPI {
|
|
28
|
-
constructor(configuration) {
|
|
29
|
-
super(configuration);
|
|
30
|
-
this.idTokenValidator = new IDTokenValidator(configuration);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Start passwordless flow sending an email.
|
|
34
|
-
*
|
|
35
|
-
* Given the user `email` address, it will send an email with:
|
|
36
|
-
*
|
|
37
|
-
* <ul>
|
|
38
|
-
* <li>A link (default, `send:"link"`). You can then authenticate with this
|
|
39
|
-
* user opening the link and he will be automatically logged in to the
|
|
40
|
-
* application. Optionally, you can append/override parameters to the link
|
|
41
|
-
* (like `scope`, `redirect_uri`, `protocol`, `response_type`, etc.) using
|
|
42
|
-
* `authParams` object.
|
|
43
|
-
* </li>
|
|
44
|
-
* <li>
|
|
45
|
-
* A verification code (`send:"code"`). You can then authenticate with
|
|
46
|
-
* this user using the `/oauth/token` endpoint specifying `email` as
|
|
47
|
-
* `username` and `code` as `password`.
|
|
48
|
-
* </li>
|
|
49
|
-
* </ul>
|
|
50
|
-
*
|
|
51
|
-
* See: https://auth0.com/docs/api/authentication#get-code-or-link
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```js
|
|
55
|
-
* const auth0 = new AuthenticationApi({
|
|
56
|
-
* domain: 'my-domain.auth0.com',
|
|
57
|
-
* clientId: 'myClientId',
|
|
58
|
-
* clientSecret: 'myClientSecret'
|
|
59
|
-
* });
|
|
60
|
-
*
|
|
61
|
-
* await auth0.passwordless.sendEmail({
|
|
62
|
-
* email: '{EMAIL}',
|
|
63
|
-
* send: 'link',
|
|
64
|
-
* authParams: {} // Optional auth params.
|
|
65
|
-
* });
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
sendEmail(bodyParameters, initOverrides) {
|
|
69
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
validateRequiredRequestParams(bodyParameters, ["email"]);
|
|
71
|
-
const response = yield this.request({
|
|
72
|
-
path: "/passwordless/start",
|
|
73
|
-
method: "POST",
|
|
74
|
-
headers: {
|
|
75
|
-
"Content-Type": "application/json",
|
|
76
|
-
},
|
|
77
|
-
body: yield this.addClientAuthentication(Object.assign({ client_id: this.clientId, connection: "email" }, bodyParameters)),
|
|
78
|
-
}, initOverrides);
|
|
79
|
-
return VoidApiResponse.fromResponse(response);
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Start passwordless flow sending an SMS.
|
|
84
|
-
*
|
|
85
|
-
* Given the user `phone_number`, it will send a SMS message with a
|
|
86
|
-
* verification code. You can then authenticate with this user using the
|
|
87
|
-
* `/oauth/token` endpoint specifying `phone_number` as `username` and `code` as
|
|
88
|
-
* `password`:
|
|
89
|
-
*
|
|
90
|
-
* See: https://auth0.com/docs/api/authentication#get-code-or-link
|
|
91
|
-
*
|
|
92
|
-
* @example
|
|
93
|
-
* ```js
|
|
94
|
-
* const auth0 = new AuthenticationApi({
|
|
95
|
-
* domain: 'my-domain.auth0.com',
|
|
96
|
-
* clientId: 'myClientId',
|
|
97
|
-
* clientSecret: 'myClientSecret'
|
|
98
|
-
* });
|
|
99
|
-
*
|
|
100
|
-
* await auth0.passwordless.sendSMS({
|
|
101
|
-
* phone_number: '{PHONE}'
|
|
102
|
-
* });
|
|
103
|
-
* ```
|
|
104
|
-
*/
|
|
105
|
-
sendSMS(bodyParameters, initOverrides) {
|
|
106
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
-
validateRequiredRequestParams(bodyParameters, ["phone_number"]);
|
|
108
|
-
const response = yield this.request({
|
|
109
|
-
path: "/passwordless/start",
|
|
110
|
-
method: "POST",
|
|
111
|
-
headers: {
|
|
112
|
-
"Content-Type": "application/json",
|
|
113
|
-
},
|
|
114
|
-
body: yield this.addClientAuthentication(Object.assign({ client_id: this.clientId, connection: "sms" }, bodyParameters)),
|
|
115
|
-
}, initOverrides);
|
|
116
|
-
return VoidApiResponse.fromResponse(response);
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Once you have a verification code, use this endpoint to login the user with their email and verification code.
|
|
121
|
-
*
|
|
122
|
-
* @example
|
|
123
|
-
* ```js
|
|
124
|
-
* const auth0 = new AuthenticationApi({
|
|
125
|
-
* domain: 'my-domain.auth0.com',
|
|
126
|
-
* clientId: 'myClientId',
|
|
127
|
-
* clientSecret: 'myClientSecret'
|
|
128
|
-
* });
|
|
129
|
-
*
|
|
130
|
-
* await auth0.passwordless.loginWithEmail({
|
|
131
|
-
* email: 'foo@example.com',
|
|
132
|
-
* code: 'ABC123'
|
|
133
|
-
* });
|
|
134
|
-
* ```
|
|
135
|
-
*/
|
|
136
|
-
loginWithEmail(bodyParameters_1) {
|
|
137
|
-
return __awaiter(this, arguments, void 0, function* (bodyParameters, options = {}) {
|
|
138
|
-
validateRequiredRequestParams(bodyParameters, ["email", "code"]);
|
|
139
|
-
const { email: username, code: otp } = bodyParameters, otherParams = __rest(bodyParameters, ["email", "code"]);
|
|
140
|
-
return grant("http://auth0.com/oauth/grant-type/passwordless/otp", yield this.addClientAuthentication(Object.assign({ username,
|
|
141
|
-
otp, realm: "email" }, otherParams)), options, this.clientId, this.idTokenValidator, this.request.bind(this));
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Once you have a verification code, use this endpoint to login the user with their phone number and verification code.
|
|
146
|
-
*
|
|
147
|
-
* @example
|
|
148
|
-
* ```js
|
|
149
|
-
* const auth0 = new AuthenticationApi({
|
|
150
|
-
* domain: 'my-domain.auth0.com',
|
|
151
|
-
* clientId: 'myClientId',
|
|
152
|
-
* clientSecret: 'myClientSecret'
|
|
153
|
-
* });
|
|
154
|
-
*
|
|
155
|
-
* await auth0.passwordless.loginWithSMS({
|
|
156
|
-
* phone_number: '0777777777',
|
|
157
|
-
* code: 'ABC123'
|
|
158
|
-
* });
|
|
159
|
-
* ```
|
|
160
|
-
*/
|
|
161
|
-
loginWithSMS(bodyParameters_1) {
|
|
162
|
-
return __awaiter(this, arguments, void 0, function* (bodyParameters, options = {}) {
|
|
163
|
-
validateRequiredRequestParams(bodyParameters, ["phone_number", "code"]);
|
|
164
|
-
const { phone_number: username, code: otp } = bodyParameters, otherParams = __rest(bodyParameters, ["phone_number", "code"]);
|
|
165
|
-
return grant("http://auth0.com/oauth/grant-type/passwordless/otp", yield this.addClientAuthentication(Object.assign({ username,
|
|
166
|
-
otp, realm: "sms" }, otherParams)), options, this.clientId, this.idTokenValidator, this.request.bind(this));
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
}
|