@functionalcms/svelte-components 3.5.6 → 3.5.8

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.
@@ -1,4 +1,3 @@
1
1
  export declare const createMachineTokenApprovedLocals: (scope?: string) => Promise<{
2
- session: undefined;
3
- auth_token: string;
2
+ token: any;
4
3
  }>;
@@ -1,16 +1,18 @@
1
1
  import { AUTH_KEYCLOAK_ID, AUTH_KEYCLOAK_SECRET, AUTH_KEYCLOAK_ISSUER } from '$env/static/private';
2
2
  export const createMachineTokenApprovedLocals = async (scope = '') => {
3
- const response = await fetch(`${AUTH_KEYCLOAK_ISSUER}/protocol/openid-connect/token`, {
3
+ const url = `${AUTH_KEYCLOAK_ISSUER}/protocol/openid-connect/token`;
4
+ const body = new URLSearchParams({
5
+ grant_type: "client_credentials",
6
+ client_id: AUTH_KEYCLOAK_ID,
7
+ client_secret: AUTH_KEYCLOAK_SECRET,
8
+ scope: `openid profile offline_access ${scope}`,
9
+ });
10
+ const response = await fetch(url, {
4
11
  method: "POST",
5
- body: new URLSearchParams({
6
- grant_type: "client_credentials",
7
- client_id: AUTH_KEYCLOAK_ID,
8
- client_secret: AUTH_KEYCLOAK_SECRET,
9
- scope,
10
- }),
12
+ body: body,
11
13
  headers: {
12
14
  "Content-Type": "application/x-www-form-urlencoded",
13
- Accept: "application/json"
15
+ Accept: "*/*"
14
16
  }
15
17
  });
16
18
  if (!response.ok) {
@@ -19,7 +21,6 @@ export const createMachineTokenApprovedLocals = async (scope = '') => {
19
21
  }
20
22
  const token = await response.json();
21
23
  return {
22
- session: undefined,
23
- auth_token: token.access_token,
24
+ token: token,
24
25
  };
25
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@functionalcms/svelte-components",
3
- "version": "3.5.6",
3
+ "version": "3.5.8",
4
4
  "watch": {
5
5
  "build": {
6
6
  "patterns": [