File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change 7
7
type CCClientOptions ,
8
8
type SessionManager ,
9
9
type PKCEClientOptions ,
10
- type ACClientOptions
10
+ type ACClientOptions ,
11
+ Configuration ,
12
+ type ConfigurationParameters
11
13
} from '@kinde-oss/kinde-typescript-sdk' ;
12
14
import { omit } from './utils/index.js' ;
13
15
@@ -37,3 +39,27 @@ export const getHeaders = async () => {
37
39
Accept : 'application/json'
38
40
} ;
39
41
} ;
42
+
43
+ export const getConfiguration = async ( configurationOverrides ?: ConfigurationParameters ) => {
44
+ const kindeManagementApi = createKindeServerClient (
45
+ GrantType . CLIENT_CREDENTIALS ,
46
+ omit ( kindeConfiguration , [
47
+ 'logoutRedirectURL' ,
48
+ 'loginRedirectURL' ,
49
+ 'scope' ,
50
+ 'redirectURL'
51
+ ] ) as unknown as CCClientOptions
52
+ ) ;
53
+
54
+ const token = await kindeManagementApi . getToken ( sessionStorage as unknown as SessionManager ) ;
55
+
56
+ const config = new Configuration ( {
57
+ basePath : kindeConfiguration . authDomain ,
58
+ accessToken : token ,
59
+ headers : {
60
+ Accept : 'application/json'
61
+ } ,
62
+ ...( configurationOverrides || { } )
63
+ } ) ;
64
+ return config ;
65
+ } ;
You can’t perform that action at this time.
0 commit comments