@commercetools-frontend/mc-dev-authentication 18.5.4 → 20.10.6

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 CHANGED
@@ -1,5 +1,33 @@
1
1
  # @commercetools-frontend/mc-dev-authentication
2
2
 
3
+ ## 20.10.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2386](https://github.com/commercetools/merchant-center-application-kit/pull/2386) [`d7fcf6fc`](https://github.com/commercetools/merchant-center-application-kit/commit/d7fcf6fc8495d4eae68e0a4f4c1f1b3e0e394454) Thanks [@emmenko](https://github.com/emmenko)! - Upgrade to Yarn v3
8
+
9
+ ## 20.10.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [#2376](https://github.com/commercetools/merchant-center-application-kit/pull/2376) [`9d879503`](https://github.com/commercetools/merchant-center-application-kit/commit/9d879503f7af467729291d66a35625b6e7cbb385) Thanks [@emmenko](https://github.com/emmenko)! - > For commercetools only.
14
+
15
+ Allow to use OIDC login when developing against a local running MC API.
16
+
17
+ ## 20.10.1
18
+
19
+ ### Patch Changes
20
+
21
+ - [#2356](https://github.com/commercetools/merchant-center-application-kit/pull/2356) [`e34fe076`](https://github.com/commercetools/merchant-center-application-kit/commit/e34fe076aab6681cdcc54622d84123f2c22020e6) Thanks [@ByronDWall](https://github.com/ByronDWall)! - set node version to 16.8 in nvmrc to avoid a bug in node/v8
22
+
23
+ ## 19.0.0
24
+
25
+ ### Major Changes
26
+
27
+ - [#2041](https://github.com/commercetools/merchant-center-application-kit/pull/2041) [`a240f657`](https://github.com/commercetools/merchant-center-application-kit/commit/a240f6574a9240a2ac82febb67b0f6c814db979f) Thanks [@emmenko](https://github.com/emmenko)! - - Changes required Node.js engine version to `>=12 || >=14` in `package.json`.
28
+
29
+ * [#2041](https://github.com/commercetools/merchant-center-application-kit/pull/2041) [`a240f657`](https://github.com/commercetools/merchant-center-application-kit/commit/a240f6574a9240a2ac82febb67b0f6c814db979f) Thanks [@emmenko](https://github.com/emmenko)! - Upgrade and migrate packages to use `ui-kit@v12`
30
+
3
31
  ## 18.5.4
4
32
 
5
33
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/mc-dev-authentication",
3
- "version": "18.5.4",
3
+ "version": "20.10.6",
4
4
  "description": "Authentication views when running webpack-dev-server in development mode",
5
5
  "bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
6
6
  "repository": {
@@ -8,11 +8,9 @@
8
8
  "url": "https://github.com/commercetools/merchant-center-application-kit.git",
9
9
  "directory": "packages/mc-dev-authentication"
10
10
  },
11
- "scripts": {},
12
11
  "homepage": "https://docs.commercetools.com/custom-applications",
13
12
  "keywords": ["javascript", "frontend", "react", "toolkit"],
14
13
  "license": "MIT",
15
- "private": false,
16
14
  "publishConfig": {
17
15
  "access": "public"
18
16
  },
@@ -20,7 +18,6 @@
20
18
  "pug": "3.0.2"
21
19
  },
22
20
  "engines": {
23
- "node": ">=8",
24
- "npm": ">=5"
21
+ "node": ">=12 || >=14"
25
22
  }
26
23
  }
package/views/login.js CHANGED
@@ -20,6 +20,16 @@ window.addEventListener('load', function loaded() {
20
20
  password: data.get('password'),
21
21
  };
22
22
 
23
+ var queryParams = new URLSearchParams(window.location.search);
24
+ if (queryParams.has('response_type')) {
25
+ // OIDC params
26
+ payload.client_id = queryParams.get('client_id');
27
+ payload.response_type = queryParams.get('response_type');
28
+ payload.scope = queryParams.get('scope');
29
+ payload.state = queryParams.get('state');
30
+ payload.nonce = queryParams.get('nonce');
31
+ }
32
+
23
33
  var container = document.getElementById('errors');
24
34
  // Clean up error message elements
25
35
  while (container.firstChild) {
@@ -40,11 +50,16 @@ window.addEventListener('load', function loaded() {
40
50
  })
41
51
  .then(function handleResponse(response) {
42
52
  if (response.ok) {
43
- return response.json().then(function onSuccess() {
44
- window.localStorage.setItem('isAuthenticated', true);
45
- var searchParams = new URLSearchParams(window.location.search);
46
- var redirectTo = searchParams.get('redirectTo') || '/';
47
- window.location.replace(redirectTo);
53
+ return response.json().then(function onSuccess(result) {
54
+ // Handle OIDC redirect.
55
+ if (queryParams.has('response_type')) {
56
+ window.location.replace(result.redirectTo);
57
+ } else {
58
+ window.localStorage.setItem('isAuthenticated', true);
59
+ var searchParams = new URLSearchParams(window.location.search);
60
+ var redirectTo = searchParams.get('redirectTo') || '/';
61
+ window.location.replace(redirectTo);
62
+ }
48
63
  });
49
64
  }
50
65
  return response.text().then(function onError(responseText) {