File tree Expand file tree Collapse file tree 3 files changed +304
-4
lines changed Expand file tree Collapse file tree 3 files changed +304
-4
lines changed Original file line number Diff line number Diff line change
1
+ import request from 'request' ;
2
+
3
+ const client_secret = process . env . EVENTS_API_CLIENT_SECRET ;
4
+ if ( ! client_secret ) {
5
+ console . error ( "Did not find client secret in environment." ) ;
6
+ process . exit ( 1 ) ;
7
+ }
8
+
9
+ var options = {
10
+ 'method' : 'POST' ,
11
+ 'url' : 'https://login.microsoftonline.com/c8d9148f-9a59-4db3-827d-42ea0c2b6e2e/oauth2/token' ,
12
+ 'headers' : {
13
+ 'Content-Type' : 'application/x-www-form-urlencoded' ,
14
+ 'Cookie' : 'esctx=PAQABBwEAAAApTwJmzXqdR4BN2miheQMYx8m4odNFiSkFXBDxAsyDVihl0yV2geMRVf-xYZ_GI34ZgJzPlzsLI4IyGrHFUcRyt_kOrGgfKtxKD_l8Shb9DAyh2xT4JeGXJhIyqsMO-lMmpvDuGjePONePVhmPE4TzQuQUh6V8Y4yWwBV10HljcSWz0Jp0DGs5MB4wMCl3CVwgAA; fpc=Asmn40XcT3RJkq8G_zKhA64gJa0wAQAAANHbRN4OAAAADPYZNQMAAADZ20TeDgAAABa8tnsBAAAAeN1E3g4AAAA; stsservicecookie=estsfd; x-ms-gateway-slice=estsfd'
15
+ } ,
16
+ form : {
17
+ 'grant_type' : 'client_credentials' ,
18
+ 'client_id' : '519866d4-45a8-44ae-9925-9fb61b85074e' ,
19
+ 'client_secret' : client_secret ,
20
+ 'resource' : 'api://5e08cf0f-53bb-4e09-9df2-e9bdc3467296' ,
21
+ 'scope' : 'api://5e08cf0f-53bb-4e09-9df2-e9bdc3467296/ACM.Events.Login'
22
+ }
23
+ } ;
24
+ request ( options , function ( error , response ) {
25
+ if ( error ) throw new Error ( error ) ;
26
+ console . log ( JSON . parse ( response . body ) [ 'access_token' ] ) ;
27
+ } ) ;
28
+
Original file line number Diff line number Diff line change 29
29
"eslint-plugin-import" : " ^2.29.1" ,
30
30
"eslint-plugin-prettier" : " ^5.2.1" ,
31
31
"prettier" : " ^3.3.3" ,
32
+ "request" : " ^2.88.2" ,
32
33
"synp" : " ^1.9.13" ,
33
34
"tsx" : " ^4.16.5" ,
34
35
"typescript" : " ^5.5.4"
You can’t perform that action at this time.
0 commit comments