@schibsted/account-sdk-browser 4.5.3 → 4.7.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/CHANGELOG.md +8 -0
- package/README.md +4 -8
- package/es5/global.js +11 -9
- package/es5/global.js.map +1 -1
- package/es5/global.min.js +1 -1
- package/es5/global.min.js.map +1 -1
- package/es5/identity.js +11 -9
- package/es5/identity.js.map +1 -1
- package/es5/identity.min.js +1 -1
- package/es5/identity.min.js.map +1 -1
- package/es5/index.js +11 -9
- package/es5/index.js.map +1 -1
- package/es5/index.min.js +1 -1
- package/es5/index.min.js.map +1 -1
- package/es5/monetization.js +1 -1
- package/es5/monetization.min.js +1 -1
- package/package.json +1 -1
- package/src/identity.d.ts +10 -7
- package/src/identity.js +11 -9
package/src/identity.js
CHANGED
|
@@ -22,13 +22,12 @@ const { version } = require('../package.json');
|
|
|
22
22
|
* the request and callback. It's also recommended to prevent CSRF {@link https://tools.ietf.org/html/rfc6749#section-10.12}
|
|
23
23
|
* @property {string} [acrValues] - Authentication Context Class Reference Values. If
|
|
24
24
|
* omitted, the user will be asked to authenticate using username+password.
|
|
25
|
-
* For 2FA (Two-Factor Authentication) possible values are `sms`, `otp` (one time password)
|
|
26
|
-
* `password` (will force password confirmation, even if user is already logged in)
|
|
25
|
+
* For 2FA (Two-Factor Authentication) possible values are `sms`, `otp` (one time password),
|
|
26
|
+
* `password` (will force password confirmation, even if user is already logged in), `eid`. Those values might
|
|
27
27
|
* be mixed as space-separated string. To make sure that user has authenticated with 2FA you need
|
|
28
28
|
* to verify AMR (Authentication Methods References) claim in ID token.
|
|
29
29
|
* Might also be used to ensure additional acr (sms, otp) for already logged in users.
|
|
30
|
-
* Supported
|
|
31
|
-
* one time password using sms.
|
|
30
|
+
* Supported value is also 'otp-email' means one time password using email.
|
|
32
31
|
* @property {string} [scope] - The OAuth scopes for the tokens. This is a list of
|
|
33
32
|
* scopes, separated by space. If the list of scopes contains `openid`, the generated tokens
|
|
34
33
|
* includes the id token which can be useful for getting information about the user. Omitting
|
|
@@ -62,8 +61,7 @@ const { version } = require('../package.json');
|
|
|
62
61
|
* be mixed as space-separated string. To make sure that user has authenticated with 2FA you need
|
|
63
62
|
* to verify AMR (Authentication Methods References) claim in ID token.
|
|
64
63
|
* Might also be used to ensure additional acr (sms, otp) for already logged in users.
|
|
65
|
-
* Supported
|
|
66
|
-
* one time password using sms.
|
|
64
|
+
* Supported value is also 'otp-email' means one time password using email.
|
|
67
65
|
* @property {string} [scope] - The OAuth scopes for the tokens. This is a list of
|
|
68
66
|
* scopes, separated by space. If the list of scopes contains `openid`, the generated tokens
|
|
69
67
|
* includes the id token which can be useful for getting information about the user. Omitting
|
|
@@ -783,8 +781,8 @@ export class Identity extends EventEmitter {
|
|
|
783
781
|
teaser = arguments[6] || teaser;
|
|
784
782
|
maxAge = isNaN(arguments[7]) ? maxAge : arguments[7];
|
|
785
783
|
}
|
|
786
|
-
const isValidAcrValue = (acrValue) => isStrIn(acrValue, ['password', 'otp', 'sms'], true);
|
|
787
|
-
assert(!acrValues || isStrIn(acrValues, ['', 'otp-email'
|
|
784
|
+
const isValidAcrValue = (acrValue) => isStrIn(acrValue, ['password', 'otp', 'sms', 'eid-no', 'eid-se', 'eid'], true);
|
|
785
|
+
assert(!acrValues || isStrIn(acrValues, ['', 'otp-email'], true) || acrValues.split(' ').every(isValidAcrValue),
|
|
788
786
|
`The acrValues parameter is not acceptable: ${acrValues}`);
|
|
789
787
|
assert(isUrl(redirectUri),
|
|
790
788
|
`loginUrl(): redirectUri must be a valid url but is ${redirectUri}`);
|
|
@@ -854,7 +852,7 @@ export class Identity extends EventEmitter {
|
|
|
854
852
|
* @return {Promise<boolean|SDKError>} - will resolve to true if widget will be display. Otherwise will throw SDKError
|
|
855
853
|
*/
|
|
856
854
|
async showSimplifiedLoginWidget(loginParams, options) {
|
|
857
|
-
// getUserContextData
|
|
855
|
+
// getUserContextData doesn't throw exception
|
|
858
856
|
const userData = await this.getUserContextData();
|
|
859
857
|
|
|
860
858
|
const queryParams = { client_id: this.clientId };
|
|
@@ -890,6 +888,10 @@ export class Identity extends EventEmitter {
|
|
|
890
888
|
},
|
|
891
889
|
};
|
|
892
890
|
|
|
891
|
+
if (options && options.locale) {
|
|
892
|
+
initialParams.locale = options.locale;
|
|
893
|
+
}
|
|
894
|
+
|
|
893
895
|
const loginHandler = async () => {
|
|
894
896
|
this.login(Object.assign(await prepareLoginParams(loginParams), {loginHint: userData.identifier}));
|
|
895
897
|
};
|