Skip to content

Commit fba803e

Browse files
authored
Merge pull request #16 from kinde-oss/dave/fix-audience
Prevent audience being doubled
2 parents eeed0c9 + 8f71621 commit fba803e

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

src/lib/KindeSDK.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {kindeConfiguration} from '$lib/config/index.js';
1+
import {kindeConfiguration, kindeAPIConfiguration} from '$lib/config/index.js';
22
import {sessionStorage} from '$lib/sessionStorage/index.js';
33

44
import {
@@ -24,12 +24,7 @@ export const kindeAuthClient = createKindeServerClient(
2424
export const getHeaders = async () => {
2525
const kindeManagementApi = createKindeServerClient(
2626
GrantType.CLIENT_CREDENTIALS,
27-
omit(kindeConfiguration, [
28-
'logoutRedirectURL',
29-
'loginRedirectURL',
30-
'scope',
31-
'redirectURL'
32-
]) as unknown as CCClientOptions
27+
kindeAPIConfiguration as unknown as CCClientOptions
3328
);
3429

3530
const token = await kindeManagementApi.getToken(sessionStorage as unknown as SessionManager);
@@ -43,12 +38,7 @@ export const getHeaders = async () => {
4338
export const getConfiguration = async (configurationOverrides?: ConfigurationParameters) => {
4439
const kindeManagementApi = createKindeServerClient(
4540
GrantType.CLIENT_CREDENTIALS,
46-
omit(kindeConfiguration, [
47-
'logoutRedirectURL',
48-
'loginRedirectURL',
49-
'scope',
50-
'redirectURL'
51-
]) as unknown as CCClientOptions
41+
kindeAPIConfiguration as unknown as CCClientOptions
5242
);
5343

5444
const token = await kindeManagementApi.getToken(sessionStorage as unknown as SessionManager);

src/lib/config/config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ export const kindeConfiguration = {
1313
loginRedirectURL: env.KINDE_POST_LOGIN_REDIRECT_URL,
1414
authUsePKCE: [true, 'true'].includes(env.KINDE_AUTH_WITH_PKCE)
1515
};
16+
17+
export const kindeAPIConfiguration = {
18+
audience: `${env.KINDE_ISSUER_URL}/api`,
19+
clientId: env.KINDE_CLIENT_ID,
20+
clientSecret: env.KINDE_CLIENT_SECRET
21+
};

0 commit comments

Comments
 (0)