This repository has been archived by the owner. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +22
-2
lines changed
Expand file tree Collapse file tree 4 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -64,4 +64,18 @@ function passTokenToApi() {
6464 console . log ( err ) ;
6565 }
6666 } ) ;
67+ }
68+
69+ function editProfile ( ) {
70+
71+ const request = {
72+ scopes : [ "https://fabrikamb2c.onmicrosoft.com/helloapi/demo.read" ] ,
73+ authority : b2cPolicies . authorities . editProfile . authority
74+ }
75+
76+ myMSALObj . loginPopup ( request )
77+ . then ( tokenResponse => {
78+ console . log ( "access_token acquired at: " + new Date ( ) . toString ( ) ) ;
79+ console . log ( tokenResponse ) ;
80+ } ) ;
6781}
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ <h5 class="card-header text-center">Getting an access token with Azure AD B2C an
3636 < h5 id ="label " class ="card-title "> Sign-in with Microsoft Azure AD B2C</ h5 >
3737 < pre id ="response " class ="card-text "> </ pre >
3838 < button type ="button " id ="callApiButton " class ="btn btn-primary d-none " onclick ="passTokenToApi() "> Call API</ button >
39+ < button type ="button " id ="editProfileButton " class ="btn btn-primary d-none " onclick ="editProfile() "> Edit Profile</ button >
3940 </ div >
4041 </ div >
4142
Original file line number Diff line number Diff line change @@ -14,5 +14,8 @@ const b2cPolicies = {
1414 forgotPassword : {
1515 authority : "https://fabrikamb2c.b2clogin.com/fabrikamb2c.onmicrosoft.com/b2c_1_reset" ,
1616 } ,
17+ editProfile : {
18+ authority : "https://fabrikamb2c.b2clogin.com/fabrikamb2c.onmicrosoft.com/b2c_1_edit_profile"
19+ }
1720 } ,
1821}
Original file line number Diff line number Diff line change 22const signInButton = document . getElementById ( 'signIn' ) ;
33const signOutButton = document . getElementById ( 'signOut' ) ;
44const callWebApiButton = document . getElementById ( 'callApiButton' ) ;
5+ const editProfileButton = document . getElementById ( 'editProfileButton' ) ;
56const label = document . getElementById ( 'label' ) ;
67const response = document . getElementById ( "response" ) ;
78
@@ -17,8 +18,9 @@ function updateUI() {
1718 label . innerText = "Hello " + userName ;
1819
1920 // add the callWebApi button
20- callWebApiButton . classList . add ( 'd-none' ) ;
21- callWebApiButton . setAttribute ( 'class' , 'btn btn-primary' ) ;
21+ callWebApiButton . classList . remove ( 'd-none' ) ;
22+ // add the callWebApi button
23+ editProfileButton . classList . remove ( 'd-none' ) ;
2224}
2325
2426// debug helper
You can’t perform that action at this time.
0 commit comments