auth0-lock 14.2.4 → 14.3.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/.github/workflows/release.yml +4 -1
- package/.github/workflows/test.yml +1 -1
- package/.version +1 -1
- package/CHANGELOG.md +22 -0
- package/README.md +1 -1
- package/babel.config.js +15 -0
- package/lib/__tests__/connection/enterprise/matchConnection.js +66 -0
- package/lib/connection/enterprise.js +2 -2
- package/lib/connection/social/index.js +0 -3
- package/lib/core/web_api/helper.js +1 -1
- package/lib/core/web_api/p2_api.js +5 -2
- package/lib/core.js +1 -1
- package/lib/i18n.js +1 -1
- package/lib/lock.js +1 -1
- package/lib/passwordless.js +1 -1
- package/package.json +7 -5
- package/types/auth0-lock-tests.ts +178 -0
- package/types/index.d.ts +282 -0
- package/types/tsconfig.json +21 -0
- package/webpack.config.js +21 -1
package/lib/i18n.js
CHANGED
|
@@ -90,7 +90,7 @@ function assertLanguage(m, language, base) {
|
|
|
90
90
|
function syncLang(m, language, _cb) {
|
|
91
91
|
(0, _cdn_utils.load)({
|
|
92
92
|
method: 'registerLanguageDictionary',
|
|
93
|
-
url: "".concat(l.languageBaseUrl(m), "/js/lock/").concat("14.
|
|
93
|
+
url: "".concat(l.languageBaseUrl(m), "/js/lock/").concat("14.3.0", "/").concat(language, ".js"),
|
|
94
94
|
check: function check(str) {
|
|
95
95
|
return str && str === language;
|
|
96
96
|
},
|
package/lib/lock.js
CHANGED
|
@@ -36,7 +36,7 @@ var Auth0Lock = exports.default = /*#__PURE__*/function (_Core) {
|
|
|
36
36
|
_inherits(Auth0Lock, _Core);
|
|
37
37
|
return _createClass(Auth0Lock);
|
|
38
38
|
}(_core.default); // telemetry
|
|
39
|
-
Auth0Lock.version = "14.
|
|
39
|
+
Auth0Lock.version = "14.3.0";
|
|
40
40
|
|
|
41
41
|
// TODO: should we have different telemetry for classic/passwordless?
|
|
42
42
|
// TODO: should we set telemetry info before each request?
|
package/lib/passwordless.js
CHANGED
|
@@ -36,4 +36,4 @@ var Auth0LockPasswordless = exports.default = /*#__PURE__*/function (_Core) {
|
|
|
36
36
|
_inherits(Auth0LockPasswordless, _Core);
|
|
37
37
|
return _createClass(Auth0LockPasswordless);
|
|
38
38
|
}(_core.default);
|
|
39
|
-
Auth0LockPasswordless.version = "14.
|
|
39
|
+
Auth0LockPasswordless.version = "14.3.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auth0-lock",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.0",
|
|
4
4
|
"description": "Auth0 Lock",
|
|
5
5
|
"author": "Auth0 <support@auth0.com> (http://auth0.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"url": "git://github.com/auth0/lock"
|
|
20
20
|
},
|
|
21
21
|
"main": "lib/index.js",
|
|
22
|
+
"types": "types/index.d.ts",
|
|
22
23
|
"scripts": {
|
|
23
24
|
"start": "grunt dev",
|
|
24
25
|
"prebuild": "grunt dist",
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
"i18n:validate": "node scripts/lang-audit.mjs"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
|
-
"@auth0/component-cdn-uploader": "^
|
|
44
|
+
"@auth0/component-cdn-uploader": "^3.0.2",
|
|
44
45
|
"@babel/core": "^7.0.0",
|
|
45
46
|
"@babel/eslint-parser": "^7.22.9",
|
|
46
47
|
"@babel/plugin-proposal-class-properties": "^7.0.0",
|
|
@@ -63,6 +64,7 @@
|
|
|
63
64
|
"@babel/preset-react": "^7.0.0",
|
|
64
65
|
"@cfaester/enzyme-adapter-react-18": "^0.8.0",
|
|
65
66
|
"@google-cloud/translate": "^9.1.0",
|
|
67
|
+
"@types/auth0-js": "^9.21.6",
|
|
66
68
|
"babel-jest": "^29.3.1",
|
|
67
69
|
"babel-loader": "8.4.1",
|
|
68
70
|
"babel-plugin-stylus-compiler": "^1.4.0",
|
|
@@ -115,18 +117,18 @@
|
|
|
115
117
|
"watchify": "^4.0.0",
|
|
116
118
|
"webpack": "^5.75.0",
|
|
117
119
|
"webpack-cli": "^5.0.0",
|
|
118
|
-
"webpack-dev-server": "^
|
|
120
|
+
"webpack-dev-server": "^5.2.1"
|
|
119
121
|
},
|
|
120
122
|
"dependencies": {
|
|
121
123
|
"auth0-js": "^9.29.0",
|
|
122
|
-
"auth0-password-policies": "^1.0
|
|
124
|
+
"auth0-password-policies": "^3.1.0",
|
|
123
125
|
"blueimp-md5": "^2.19.0",
|
|
124
126
|
"classnames": "^2.3.2",
|
|
125
127
|
"dompurify": "^3.2.5",
|
|
126
128
|
"events": "^3.3.0",
|
|
127
129
|
"immutable": "^3.7.6",
|
|
128
130
|
"jsonp": "^0.2.1",
|
|
129
|
-
"password-sheriff": "^
|
|
131
|
+
"password-sheriff": "^2.0.0",
|
|
130
132
|
"prop-types": "^15.8.0",
|
|
131
133
|
"qs": "^6.14.1",
|
|
132
134
|
"react": "^18.2.0",
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import * as auth0 from "auth0-js";
|
|
2
|
+
import Auth0Lock, { Auth0LockPasswordless } from "auth0-lock";
|
|
3
|
+
|
|
4
|
+
const CLIENT_ID = "YOUR_AUTH0_APP_CLIENTID";
|
|
5
|
+
const DOMAIN = "YOUR_DOMAIN_AT.auth0.com";
|
|
6
|
+
|
|
7
|
+
// Basic instantiation
|
|
8
|
+
const lock: Auth0LockStatic = new Auth0Lock(CLIENT_ID, DOMAIN);
|
|
9
|
+
|
|
10
|
+
lock.show();
|
|
11
|
+
lock.hide();
|
|
12
|
+
lock.logout(() => {});
|
|
13
|
+
|
|
14
|
+
// checkSession
|
|
15
|
+
lock.checkSession({}, function (error: auth0.Auth0Error, authResult: AuthResult | undefined): void {
|
|
16
|
+
if (error || !authResult) {
|
|
17
|
+
lock.show();
|
|
18
|
+
} else {
|
|
19
|
+
lock.getUserInfo(authResult.accessToken, function (error, profile) {
|
|
20
|
+
console.log(error, profile);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// show with options
|
|
26
|
+
const showOptions: Auth0LockShowOptions = {
|
|
27
|
+
allowedConnections: ["twitter", "facebook"],
|
|
28
|
+
allowAutocomplete: true,
|
|
29
|
+
allowPasswordAutocomplete: false,
|
|
30
|
+
allowShowPassword: true,
|
|
31
|
+
allowSignUp: true,
|
|
32
|
+
allowForgotPassword: false,
|
|
33
|
+
auth: {
|
|
34
|
+
autoParseHash: true,
|
|
35
|
+
params: { state: "foo" },
|
|
36
|
+
redirect: true,
|
|
37
|
+
redirectUrl: "some url",
|
|
38
|
+
responseType: "token",
|
|
39
|
+
sso: true,
|
|
40
|
+
},
|
|
41
|
+
initialScreen: "login",
|
|
42
|
+
flashMessage: {
|
|
43
|
+
type: "error",
|
|
44
|
+
text: "an error has occurred",
|
|
45
|
+
},
|
|
46
|
+
language: "en",
|
|
47
|
+
languageDictionary: { title: "test" },
|
|
48
|
+
rememberLastLogin: false,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
lock.show(showOptions);
|
|
52
|
+
|
|
53
|
+
// on / off events
|
|
54
|
+
lock.on("authenticated", function (authResult: AuthResult) {
|
|
55
|
+
lock.getUserInfo(authResult.accessToken, function (error, profile) {
|
|
56
|
+
console.log(error, profile);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
lock.off("authenticated", (authResult) => {});
|
|
61
|
+
|
|
62
|
+
// Theme options
|
|
63
|
+
new Auth0Lock(CLIENT_ID, DOMAIN, {
|
|
64
|
+
theme: {
|
|
65
|
+
authButtons: {
|
|
66
|
+
fooProvider: { displayName: "foo" },
|
|
67
|
+
},
|
|
68
|
+
hideMainScreenTitle: false,
|
|
69
|
+
labeledSubmitButton: false,
|
|
70
|
+
logo: "https://example.com/assets/logo.png",
|
|
71
|
+
primaryColor: "green",
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// Auth options
|
|
76
|
+
new Auth0Lock(CLIENT_ID, DOMAIN, {
|
|
77
|
+
auth: {
|
|
78
|
+
autoParseHash: true,
|
|
79
|
+
params: { state: "foo" },
|
|
80
|
+
redirect: true,
|
|
81
|
+
redirectUrl: "some url",
|
|
82
|
+
responseType: "token",
|
|
83
|
+
sso: true,
|
|
84
|
+
audience: "https://api.example.com",
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// Previously missing options — these are the options added in this release
|
|
89
|
+
new Auth0Lock(CLIENT_ID, DOMAIN, {
|
|
90
|
+
forceAutoHeight: true,
|
|
91
|
+
mobile: true,
|
|
92
|
+
disableWarnings: true,
|
|
93
|
+
preferConnectionDisplayName: true,
|
|
94
|
+
useCustomPasswordlessConnection: true,
|
|
95
|
+
emailFirst: true,
|
|
96
|
+
connectionResolver: (userInput, context, callback) => {
|
|
97
|
+
callback({ name: "my-connection" });
|
|
98
|
+
},
|
|
99
|
+
hooks: {
|
|
100
|
+
loggingIn: (context, cb) => {
|
|
101
|
+
cb();
|
|
102
|
+
},
|
|
103
|
+
signingUp: (context, cb) => {
|
|
104
|
+
cb();
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// All constructor options
|
|
110
|
+
const allOptions: Auth0LockConstructorOptions = {
|
|
111
|
+
additionalSignUpFields: [{ name: "address", placeholder: "enter your address" }],
|
|
112
|
+
allowedConnections: ["Username-Password-Authentication"],
|
|
113
|
+
allowAutocomplete: true,
|
|
114
|
+
allowForgotPassword: true,
|
|
115
|
+
allowLogin: true,
|
|
116
|
+
allowPasswordAutocomplete: false,
|
|
117
|
+
allowSignUp: true,
|
|
118
|
+
allowShowPassword: true,
|
|
119
|
+
assetsUrl: "https://example.com/assets",
|
|
120
|
+
autoclose: true,
|
|
121
|
+
autofocus: false,
|
|
122
|
+
avatar: null,
|
|
123
|
+
clientBaseUrl: "http://www.example.com",
|
|
124
|
+
closable: true,
|
|
125
|
+
configurationBaseUrl: "https://cdn.auth0.com",
|
|
126
|
+
connectionResolver: (userInput, context, callback) => { callback({ name: "my-connection" }); },
|
|
127
|
+
container: "myContainer",
|
|
128
|
+
defaultADUsernameFromEmailPrefix: false,
|
|
129
|
+
defaultDatabaseConnection: "Username-Password-Authentication",
|
|
130
|
+
defaultEnterpriseConnection: "my-enterprise",
|
|
131
|
+
disableWarnings: false,
|
|
132
|
+
emailFirst: false,
|
|
133
|
+
flashMessage: { type: "success", text: "Logged in!" },
|
|
134
|
+
forceAutoHeight: false,
|
|
135
|
+
forgotPasswordLink: "https://example.com/forgot",
|
|
136
|
+
hashCleanup: true,
|
|
137
|
+
hooks: {
|
|
138
|
+
loggingIn: (context, cb) => { cb(); },
|
|
139
|
+
signingUp: (context, cb) => { cb(); },
|
|
140
|
+
},
|
|
141
|
+
initialScreen: "login",
|
|
142
|
+
language: "en",
|
|
143
|
+
languageBaseUrl: "http://www.example.com",
|
|
144
|
+
languageDictionary: { title: "My App" },
|
|
145
|
+
leeway: 30,
|
|
146
|
+
legacySameSiteCookie: false,
|
|
147
|
+
loginAfterSignUp: true,
|
|
148
|
+
mobile: false,
|
|
149
|
+
mustAcceptTerms: false,
|
|
150
|
+
popupOptions: { width: 500, height: 600, left: 100, top: 100 },
|
|
151
|
+
preferConnectionDisplayName: false,
|
|
152
|
+
prefill: { email: "user@example.com" },
|
|
153
|
+
rememberLastLogin: true,
|
|
154
|
+
scrollGlobalMessagesIntoView: true,
|
|
155
|
+
showTerms: true,
|
|
156
|
+
signUpFieldsStrictValidation: true,
|
|
157
|
+
signUpHideUsernameField: false,
|
|
158
|
+
signUpLink: "https://example.com/signup",
|
|
159
|
+
socialButtonStyle: "big",
|
|
160
|
+
theme: { primaryColor: "#ea5323" },
|
|
161
|
+
useCustomPasswordlessConnection: false,
|
|
162
|
+
usernameStyle: "username",
|
|
163
|
+
_enableImpersonation: false,
|
|
164
|
+
_enableIdPInitiatedLogin: false,
|
|
165
|
+
_sendTelemetry: true,
|
|
166
|
+
_telemetryInfo: { name: "my-sdk", version: "1.0.0", env: { "auth0.js": "9.0.0" } },
|
|
167
|
+
__useTenantInfo: false,
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
new Auth0Lock(CLIENT_ID, DOMAIN, allOptions);
|
|
171
|
+
|
|
172
|
+
// Passwordless
|
|
173
|
+
new Auth0LockPasswordless(CLIENT_ID, DOMAIN);
|
|
174
|
+
|
|
175
|
+
new Auth0LockPasswordless(CLIENT_ID, DOMAIN, {
|
|
176
|
+
passwordlessMethod: "code",
|
|
177
|
+
forceAutoHeight: true,
|
|
178
|
+
});
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
/// <reference types="auth0-js" />
|
|
2
|
+
|
|
3
|
+
interface Auth0LockAdditionalSignUpFieldOption {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
type Auth0LockAdditionalSignUpFieldOptionsCallback = (
|
|
9
|
+
error: auth0.Auth0Error,
|
|
10
|
+
options: Auth0LockAdditionalSignUpFieldOption[],
|
|
11
|
+
) => void;
|
|
12
|
+
|
|
13
|
+
type Auth0LockAdditionalSignUpFieldOptionsFunction = (callback: Auth0LockAdditionalSignUpFieldOptionsCallback) => void;
|
|
14
|
+
|
|
15
|
+
type Auth0LockAdditionalSignUpFieldPrefillCallback = (error: auth0.Auth0Error, prefill: string) => void;
|
|
16
|
+
|
|
17
|
+
type Auth0LockAdditionalSignUpFieldPrefillFunction = (callback: Auth0LockAdditionalSignUpFieldPrefillCallback) => void;
|
|
18
|
+
|
|
19
|
+
interface Auth0LockAdditionalTextSignUpField {
|
|
20
|
+
type?: "text" | undefined;
|
|
21
|
+
icon?: string | undefined;
|
|
22
|
+
name: string;
|
|
23
|
+
options?: Auth0LockAdditionalSignUpFieldOption[] | Auth0LockAdditionalSignUpFieldOptionsFunction | undefined;
|
|
24
|
+
placeholder: string;
|
|
25
|
+
prefill?: string | Auth0LockAdditionalSignUpFieldPrefillFunction | undefined;
|
|
26
|
+
validator?: ((input: string) => { valid: boolean; hint?: string | undefined }) | undefined;
|
|
27
|
+
storage?: "root" | undefined;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface Auth0LockAdditionalSelectSignUpField {
|
|
31
|
+
type?: "select" | undefined;
|
|
32
|
+
icon?: string | undefined;
|
|
33
|
+
name: string;
|
|
34
|
+
options?: Auth0LockAdditionalSignUpFieldOption[] | Auth0LockAdditionalSignUpFieldOptionsFunction | undefined;
|
|
35
|
+
placeholder: string;
|
|
36
|
+
prefill?: string | Auth0LockAdditionalSignUpFieldPrefillFunction | undefined;
|
|
37
|
+
validator?: ((input: string) => { valid: boolean; hint?: string | undefined }) | undefined;
|
|
38
|
+
storage?: "root" | undefined;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface Auth0LockAdditionalCheckboxSignUpField {
|
|
42
|
+
type?: "checkbox" | undefined;
|
|
43
|
+
icon?: string | undefined;
|
|
44
|
+
name: string;
|
|
45
|
+
placeholder: string;
|
|
46
|
+
prefill: "true" | "false";
|
|
47
|
+
validator?: ((input: string) => { valid: boolean; hint?: string | undefined }) | undefined;
|
|
48
|
+
storage?: "root" | undefined;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface Auth0LockAdditionalHiddenSignUpField {
|
|
52
|
+
type?: "hidden" | undefined;
|
|
53
|
+
name: string;
|
|
54
|
+
value: string;
|
|
55
|
+
storage?: "root" | undefined;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
type Auth0LockAdditionalSignUpField =
|
|
59
|
+
| Auth0LockAdditionalSelectSignUpField
|
|
60
|
+
| Auth0LockAdditionalTextSignUpField
|
|
61
|
+
| Auth0LockAdditionalCheckboxSignUpField
|
|
62
|
+
| Auth0LockAdditionalHiddenSignUpField;
|
|
63
|
+
|
|
64
|
+
type Auth0LockAvatarUrlCallback = (error: auth0.Auth0Error, url: string) => void;
|
|
65
|
+
type Auth0LockAvatarDisplayNameCallback = (error: auth0.Auth0Error, displayName: string) => void;
|
|
66
|
+
|
|
67
|
+
interface Auth0LockAvatarOptions {
|
|
68
|
+
url: (email: string, callback: Auth0LockAvatarUrlCallback) => void;
|
|
69
|
+
displayName: (email: string, callback: Auth0LockAvatarDisplayNameCallback) => void;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface Auth0LockThemeButton {
|
|
73
|
+
displayName: string;
|
|
74
|
+
primaryColor?: string | undefined;
|
|
75
|
+
foregroundColor?: string | undefined;
|
|
76
|
+
icon?: string | undefined;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
interface Auth0LockThemeButtonOptions {
|
|
80
|
+
[provider: string]: Auth0LockThemeButton;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface Auth0LockThemeOptions {
|
|
84
|
+
authButtons?: Auth0LockThemeButtonOptions | undefined;
|
|
85
|
+
hideMainScreenTitle?: boolean | undefined;
|
|
86
|
+
labeledSubmitButton?: boolean | undefined;
|
|
87
|
+
logo?: string | undefined;
|
|
88
|
+
primaryColor?: string | undefined;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// https://auth0.com/docs/libraries/lock/v10/sending-authentication-parameters
|
|
92
|
+
interface Auth0LockAuthParamsOptions {
|
|
93
|
+
access_token?: any;
|
|
94
|
+
connection_scope?: any;
|
|
95
|
+
device?: any;
|
|
96
|
+
nonce?: any;
|
|
97
|
+
protocol?: any;
|
|
98
|
+
request_id?: any;
|
|
99
|
+
scope?: string | undefined;
|
|
100
|
+
state?: string | undefined;
|
|
101
|
+
[key: string]: any; // Auth0 rules can use custom params.
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
interface Auth0LockAuthOptions {
|
|
105
|
+
autoParseHash?: boolean | undefined;
|
|
106
|
+
params?: Auth0LockAuthParamsOptions | undefined;
|
|
107
|
+
redirect?: boolean | undefined;
|
|
108
|
+
redirectUrl?: string | undefined;
|
|
109
|
+
responseMode?: string | undefined;
|
|
110
|
+
responseType?: string | undefined;
|
|
111
|
+
sso?: boolean | undefined;
|
|
112
|
+
audience?: string | undefined;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
interface Auth0LockPopupOptions {
|
|
116
|
+
width: number;
|
|
117
|
+
height: number;
|
|
118
|
+
left: number;
|
|
119
|
+
top: number;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Hooks that can be used to integrate into various procedures within Lock.
|
|
123
|
+
// Both hooks receive a context (currently always null) and a callback that
|
|
124
|
+
// must be called when the hook is finished. Execution is blocked until cb() is called.
|
|
125
|
+
interface Auth0LockHooks {
|
|
126
|
+
loggingIn?: ((context: null, cb: () => void) => void) | undefined;
|
|
127
|
+
signingUp?: ((context: null, cb: () => void) => void) | undefined;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface Auth0LockConstructorOptions {
|
|
131
|
+
additionalSignUpFields?: Auth0LockAdditionalSignUpField[] | undefined;
|
|
132
|
+
allowedConnections?: string[] | undefined;
|
|
133
|
+
allowAutocomplete?: boolean | undefined;
|
|
134
|
+
allowForgotPassword?: boolean | undefined;
|
|
135
|
+
allowLogin?: boolean | undefined;
|
|
136
|
+
allowPasswordAutocomplete?: boolean | undefined;
|
|
137
|
+
allowSignUp?: boolean | undefined;
|
|
138
|
+
allowShowPassword?: boolean | undefined;
|
|
139
|
+
assetsUrl?: string | undefined;
|
|
140
|
+
auth?: Auth0LockAuthOptions | undefined;
|
|
141
|
+
autoclose?: boolean | undefined;
|
|
142
|
+
autofocus?: boolean | undefined;
|
|
143
|
+
avatar?: Auth0LockAvatarOptions | null | undefined;
|
|
144
|
+
clientBaseUrl?: string | undefined;
|
|
145
|
+
closable?: boolean | undefined;
|
|
146
|
+
configurationBaseUrl?: string | undefined;
|
|
147
|
+
connectionResolver?: ((userInput: string, context: any, callback: (connection: any) => void) => void) | undefined;
|
|
148
|
+
container?: string | undefined;
|
|
149
|
+
defaultADUsernameFromEmailPrefix?: boolean | undefined;
|
|
150
|
+
defaultDatabaseConnection?: string | undefined;
|
|
151
|
+
defaultEnterpriseConnection?: string | undefined;
|
|
152
|
+
disableWarnings?: boolean | undefined;
|
|
153
|
+
emailFirst?: boolean | undefined;
|
|
154
|
+
flashMessage?: Auth0LockFlashMessageOptions | undefined;
|
|
155
|
+
forceAutoHeight?: boolean | undefined;
|
|
156
|
+
forgotPasswordLink?: string | undefined;
|
|
157
|
+
hashCleanup?: boolean | undefined;
|
|
158
|
+
hooks?: Auth0LockHooks | undefined;
|
|
159
|
+
initialScreen?: "login" | "signUp" | "forgotPassword" | undefined;
|
|
160
|
+
language?: string | undefined;
|
|
161
|
+
languageBaseUrl?: string | undefined;
|
|
162
|
+
languageDictionary?: any;
|
|
163
|
+
leeway?: number | undefined;
|
|
164
|
+
legacySameSiteCookie?: boolean | undefined;
|
|
165
|
+
loginAfterSignUp?: boolean | undefined;
|
|
166
|
+
mobile?: boolean | undefined;
|
|
167
|
+
mustAcceptTerms?: boolean | undefined;
|
|
168
|
+
popupOptions?: Auth0LockPopupOptions | undefined;
|
|
169
|
+
preferConnectionDisplayName?: boolean | undefined;
|
|
170
|
+
prefill?: { email?: string | undefined; username?: string | undefined } | undefined;
|
|
171
|
+
rememberLastLogin?: boolean | undefined;
|
|
172
|
+
scrollGlobalMessagesIntoView?: boolean | undefined;
|
|
173
|
+
showTerms?: boolean | undefined;
|
|
174
|
+
signUpFieldsStrictValidation?: boolean | undefined;
|
|
175
|
+
signUpHideUsernameField?: boolean | undefined;
|
|
176
|
+
signUpLink?: string | undefined;
|
|
177
|
+
socialButtonStyle?: "big" | "small" | undefined;
|
|
178
|
+
theme?: Auth0LockThemeOptions | undefined;
|
|
179
|
+
useCustomPasswordlessConnection?: boolean | undefined;
|
|
180
|
+
usernameStyle?: "email" | "username" | undefined;
|
|
181
|
+
_enableImpersonation?: boolean | undefined;
|
|
182
|
+
_enableIdPInitiatedLogin?: boolean | undefined;
|
|
183
|
+
_sendTelemetry?: boolean | undefined;
|
|
184
|
+
_telemetryInfo?: { name?: string | undefined; version?: string | undefined; env?: Record<string, string> | undefined } | undefined;
|
|
185
|
+
__useTenantInfo?: boolean | undefined;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
interface Auth0LockFlashMessageOptions {
|
|
189
|
+
type: "success" | "error" | "info";
|
|
190
|
+
text: string;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
interface Auth0LockShowOptions {
|
|
194
|
+
allowedConnections?: string[] | undefined;
|
|
195
|
+
allowAutocomplete?: boolean | undefined;
|
|
196
|
+
allowForgotPassword?: boolean | undefined;
|
|
197
|
+
allowLogin?: boolean | undefined;
|
|
198
|
+
allowPasswordAutocomplete?: boolean | undefined;
|
|
199
|
+
allowShowPassword?: boolean | undefined;
|
|
200
|
+
allowSignUp?: boolean | undefined;
|
|
201
|
+
auth?: Auth0LockAuthOptions | undefined;
|
|
202
|
+
initialScreen?: "login" | "signUp" | "forgotPassword" | undefined;
|
|
203
|
+
flashMessage?: Auth0LockFlashMessageOptions | undefined;
|
|
204
|
+
language?: string | undefined;
|
|
205
|
+
languageDictionary?: any;
|
|
206
|
+
rememberLastLogin?: boolean | undefined;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
interface Auth0IdTokenPayload {
|
|
210
|
+
name?: string | undefined;
|
|
211
|
+
nickname?: string | undefined;
|
|
212
|
+
picture?: string | undefined;
|
|
213
|
+
email?: string | undefined;
|
|
214
|
+
email_verified?: boolean | undefined;
|
|
215
|
+
aud: string;
|
|
216
|
+
exp: number;
|
|
217
|
+
iat: number;
|
|
218
|
+
iss: string;
|
|
219
|
+
sub: string;
|
|
220
|
+
acr?: string | undefined;
|
|
221
|
+
amr?: string[] | undefined;
|
|
222
|
+
[key: string]: any;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
interface AuthResult {
|
|
226
|
+
accessToken: string;
|
|
227
|
+
appState?: any;
|
|
228
|
+
expiresIn: number;
|
|
229
|
+
idToken: string;
|
|
230
|
+
idTokenPayload: Auth0IdTokenPayload;
|
|
231
|
+
refreshToken?: string | undefined;
|
|
232
|
+
scope?: string | undefined;
|
|
233
|
+
state: string;
|
|
234
|
+
tokenType: string;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
interface Auth0LockCore {
|
|
238
|
+
// deprecated
|
|
239
|
+
getProfile(token: string, callback: (error: auth0.Auth0Error, profile: auth0.Auth0UserProfile) => void): void;
|
|
240
|
+
getUserInfo(token: string, callback: (error: auth0.Auth0Error, profile: auth0.Auth0UserProfile) => void): void;
|
|
241
|
+
checkSession(
|
|
242
|
+
options: Auth0LockAuthParamsOptions,
|
|
243
|
+
callback: (error: auth0.Auth0Error, authResult: AuthResult | undefined) => void,
|
|
244
|
+
): void;
|
|
245
|
+
resumeAuth(hash: string, callback: (error: auth0.Auth0Error, authResult: AuthResult) => void): void;
|
|
246
|
+
show(options?: Auth0LockShowOptions): void;
|
|
247
|
+
hide(): void;
|
|
248
|
+
logout(query: any): void;
|
|
249
|
+
|
|
250
|
+
on(event: "show" | "hide", callback: () => void): void;
|
|
251
|
+
on(event: "unrecoverable_error" | "authorization_error", callback: (error: auth0.Auth0Error) => void): void;
|
|
252
|
+
on(event: "authenticated", callback: (authResult: AuthResult) => void): void;
|
|
253
|
+
on(event: string, callback: (...args: any[]) => void): void;
|
|
254
|
+
|
|
255
|
+
off(event: "show" | "hide", callback: () => void): void;
|
|
256
|
+
off(event: "unrecoverable_error" | "authorization_error", callback: (error: auth0.Auth0Error) => void): void;
|
|
257
|
+
off(event: "authenticated", callback: (authResult: AuthResult) => void): void;
|
|
258
|
+
off(event: string, callback: (...args: any[]) => void): void;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
interface Auth0LockStatic extends Auth0LockCore {
|
|
262
|
+
new(clientId: string, domain: string, options?: Auth0LockConstructorOptions): Auth0LockStatic;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// additional options for passwordless mode
|
|
266
|
+
interface Auth0LockPasswordlessConstructorOptions extends Auth0LockConstructorOptions {
|
|
267
|
+
passwordlessMethod?: "code" | "link" | undefined;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
interface Auth0LockPasswordlessStatic extends Auth0LockCore {
|
|
271
|
+
new(
|
|
272
|
+
clientId: string,
|
|
273
|
+
domain: string,
|
|
274
|
+
options?: Auth0LockPasswordlessConstructorOptions,
|
|
275
|
+
): Auth0LockPasswordlessStatic;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
declare module "auth0-lock" {
|
|
279
|
+
export default Auth0Lock;
|
|
280
|
+
export const Auth0Lock: Auth0LockStatic;
|
|
281
|
+
export const Auth0LockPasswordless: Auth0LockPasswordlessStatic;
|
|
282
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"lib": ["es6", "dom"],
|
|
5
|
+
"noImplicitAny": true,
|
|
6
|
+
"noImplicitThis": true,
|
|
7
|
+
"strictNullChecks": true,
|
|
8
|
+
"strictFunctionTypes": true,
|
|
9
|
+
"strictBindCallApply": true,
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"baseUrl": "..",
|
|
13
|
+
"paths": {
|
|
14
|
+
"auth0-lock": ["types/index.d.ts"]
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"index.d.ts",
|
|
19
|
+
"auth0-lock-tests.ts"
|
|
20
|
+
]
|
|
21
|
+
}
|
package/webpack.config.js
CHANGED
|
@@ -2,6 +2,8 @@ const { spawnSync } = require('child_process');
|
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const tmp = require('tmp');
|
|
4
4
|
const path = require('path');
|
|
5
|
+
const pkg = require('./package.json');
|
|
6
|
+
const coreJsVersion = pkg.devDependencies['core-js'].replace(/^\^/, '');
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* This is a helper function to generate valid certs using mkcert.
|
|
@@ -44,7 +46,11 @@ module.exports = {
|
|
|
44
46
|
devServer: {
|
|
45
47
|
hot: true,
|
|
46
48
|
port: 3000,
|
|
47
|
-
|
|
49
|
+
allowedHosts: 'all',
|
|
50
|
+
server: {
|
|
51
|
+
type: 'https',
|
|
52
|
+
options: getDevCerts() || {}
|
|
53
|
+
},
|
|
48
54
|
static: {
|
|
49
55
|
directory: path.join(__dirname, 'support'),
|
|
50
56
|
publicPath: '/support'
|
|
@@ -57,6 +63,20 @@ module.exports = {
|
|
|
57
63
|
},
|
|
58
64
|
module: {
|
|
59
65
|
rules: [
|
|
66
|
+
{
|
|
67
|
+
// auth0-password-policies uses ES2020+ syntax (optional chaining) that
|
|
68
|
+
// must be transpiled for the IE 11 / ES2017 build target. Babel's
|
|
69
|
+
// .babelrc is file-relative and does not apply across package
|
|
70
|
+
// boundaries, so presets are passed explicitly here.
|
|
71
|
+
test: /\.js$/,
|
|
72
|
+
include: path.join(__dirname, 'node_modules', 'auth0-password-policies'),
|
|
73
|
+
loader: 'babel-loader',
|
|
74
|
+
options: {
|
|
75
|
+
presets: [['@babel/preset-env', { useBuiltIns: 'entry', corejs: coreJsVersion }]],
|
|
76
|
+
configFile: false,
|
|
77
|
+
babelrc: false
|
|
78
|
+
}
|
|
79
|
+
},
|
|
60
80
|
{
|
|
61
81
|
test: /\.jsx?$/,
|
|
62
82
|
loader: 'babel-loader',
|