File tree Expand file tree Collapse file tree 6 files changed +80
-6
lines changed
Expand file tree Collapse file tree 6 files changed +80
-6
lines changed Original file line number Diff line number Diff line change 2828 with :
2929 node-version : 18
3030 registry-url : https://registry.npmjs.org/
31+ - run : npm ci
32+ - run : npm run build
3133 - run : npm publish
3234 env :
3335 NODE_AUTH_TOKEN : ${{secrets.npm_token}}
Original file line number Diff line number Diff line change @@ -158,13 +158,46 @@ interface OAuthConfig {
158158 * OAuth2 credentials
159159 */
160160 credentials: {
161+ /**
162+ * OAuth flow
163+ */
161164 grantType: " client_credential" | " password" | " device_code" ;
165+ /**
166+ * Client ID
167+ */
162168 clientId: string ;
169+ /**
170+ * Client secret for ConfidentialClientApplication.
171+ * If set, clientCertificate is not required.
172+ */
163173 clientSecret? : string ;
174+ /**
175+ * Client certificate for ConfidentialClientApplication.
176+ * If set, clientSecret is not required.
177+ */
178+ clientCertificate? : {
179+ thumbprint: string ;
180+ privateKey: string ;
181+ },
182+ /**
183+ * Authority URL (eg: https://login.microsoftonline.com/common/)
184+ */
164185 authorityUrl: string ;
186+ /**
187+ * Username for password and device_code flow.
188+ */
165189 userName? : string ;
190+ /**
191+ * Password for password flow.
192+ */
166193 password? : string ;
194+ /**
195+ * Redirect URI.
196+ */
167197 redirectUri? : string ;
198+ /**
199+ * Scope. Dataverse url suffixed with .default.
200+ */
168201 scope? : string ;
169202 };
170203
Original file line number Diff line number Diff line change 11{
22 "name" : " @primno/dataverse-client" ,
3- "version" : " 0.8.0 -beta.0" ,
3+ "version" : " 0.8.1 -beta.0" ,
44 "description" : " Dataverse / Dynamics 365 CE (on-premises) client for Node.JS" ,
55 "repository" : " github:primno/dataverse-client" ,
66 "main" : " dist/index.cjs.js" ,
Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ export async function createApplication(oAuthOptions: OAuthConfig): Promise<Appl
2222 auth : {
2323 clientId : credentials . clientId ,
2424 authority : credentials . authorityUrl ,
25- clientSecret : credentials . clientSecret ,
2625 knownAuthorities : [ credentials . authorityUrl ]
2726 } ,
2827 system : {
@@ -38,10 +37,17 @@ export async function createApplication(oAuthOptions: OAuthConfig): Promise<Appl
3837 cache : persistence . enabled ? await getCacheOptions ( persistence ) : undefined
3938 } ;
4039
41- if ( credentials . clientSecret ) {
40+ if ( credentials . clientSecret || credentials . clientCertificate ) {
4241 return {
4342 type : "confidential" ,
44- client : new ConfidentialClientApplication ( options )
43+ client : new ConfidentialClientApplication ( {
44+ ...options ,
45+ auth : {
46+ ...options . auth ,
47+ clientSecret : credentials . clientSecret ,
48+ clientCertificate : credentials . clientCertificate
49+ }
50+ } )
4551 } ;
4652 }
4753 else {
Original file line number Diff line number Diff line change 11export interface OAuthCredentials {
2+ /**
3+ * OAuth flow
4+ */
25 grantType : "client_credential" | "password" | "device_code" ;
6+ /**
7+ * Client ID
8+ */
39 clientId : string ;
10+ /**
11+ * Client secret for ConfidentialClientApplication.
12+ * If set, clientCertificate is not required.
13+ */
414 clientSecret ?: string ;
15+ /**
16+ * Client certificate for ConfidentialClientApplication.
17+ * If set, clientSecret is not required.
18+ */
19+ clientCertificate ?: {
20+ thumbprint : string ;
21+ privateKey : string ;
22+ } ,
23+ /**
24+ * Authority URL (eg: https://login.microsoftonline.com/common/)
25+ */
526 authorityUrl : string ;
27+ /**
28+ * Username for password and device_code flow.
29+ */
630 userName ?: string ;
31+ /**
32+ * Password for password flow.
33+ */
734 password ?: string ;
35+ /**
36+ * Redirect URI.
37+ */
838 redirectUri ?: string ;
39+ /**
40+ * Scope. Dataverse url suffixed with .default.
41+ */
942 scope ?: string ;
1043}
1144
You can’t perform that action at this time.
0 commit comments