Skip to content

Commit 1463f3d

Browse files
committed
Merge branch 'fy2019q4-refresh' of git://github.com/juliemturner/msgraph-training-reactspa
2 parents c471f4f + a29e41b commit 1463f3d

File tree

14 files changed

+10567
-21748
lines changed

14 files changed

+10567
-21748
lines changed

02 Create AzureAD Application.pptx

-7.65 KB
Binary file not shown.

demos/01-create-app/graph-tutorial/package-lock.json

Lines changed: 3653 additions & 7067 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demos/01-create-app/graph-tutorial/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"@fortawesome/fontawesome-free": "^5.7.2",
7-
"@microsoft/microsoft-graph-client": "^1.5.2",
6+
"@fortawesome/fontawesome-free": "^5.8.2",
7+
"@microsoft/microsoft-graph-client": "^1.6.0",
88
"bootstrap": "^4.3.1",
99
"moment": "^2.24.0",
10-
"msal": "^0.2.4",
11-
"react": "^16.8.4",
12-
"react-dom": "^16.8.4",
13-
"react-router-dom": "^4.3.1",
14-
"react-scripts": "2.1.5",
15-
"reactstrap": "^7.1.0"
10+
"msal": "^1.0.0",
11+
"react": "^16.8.6",
12+
"react-dom": "^16.8.6",
13+
"react-router-dom": "^5.0.0",
14+
"react-scripts": "^3.0.1",
15+
"reactstrap": "^8.0.0"
1616
},
1717
"scripts": {
1818
"start": "react-scripts start",

demos/02-add-aad-auth/graph-tutorial/package-lock.json

Lines changed: 3640 additions & 7064 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demos/02-add-aad-auth/graph-tutorial/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"@fortawesome/fontawesome-free": "^5.7.2",
7-
"@microsoft/microsoft-graph-client": "^1.5.2",
6+
"@fortawesome/fontawesome-free": "^5.8.2",
7+
"@microsoft/microsoft-graph-client": "^1.6.0",
88
"bootstrap": "^4.3.1",
99
"moment": "^2.24.0",
10-
"msal": "^0.2.4",
11-
"react": "^16.8.4",
12-
"react-dom": "^16.8.4",
13-
"react-router-dom": "^4.3.1",
14-
"react-scripts": "2.1.5",
15-
"reactstrap": "^7.1.0"
10+
"msal": "^1.0.0",
11+
"react": "^16.8.6",
12+
"react-dom": "^16.8.6",
13+
"react-router-dom": "^5.0.0",
14+
"react-scripts": "^3.0.1",
15+
"reactstrap": "^8.0.0"
1616
},
1717
"scripts": {
1818
"start": "react-scripts start",

demos/02-add-aad-auth/graph-tutorial/src/App.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,18 @@ class App extends Component {
1313
constructor(props) {
1414
super(props);
1515

16-
this.userAgentApplication = new UserAgentApplication(config.appId, null, null);
16+
this.userAgentApplication = new UserAgentApplication({
17+
auth: {
18+
clientId: config.appId,
19+
redirectUri: "http://localhost:3000",
20+
},
21+
cache: {
22+
cacheLocation: "localStorage",
23+
storeAuthStateInCookie: true
24+
}
25+
});
1726

18-
var user = this.userAgentApplication.getUser();
27+
var user = this.userAgentApplication.getAccount();
1928

2029
this.state = {
2130
isAuthenticated: (user !== null),
@@ -65,7 +74,11 @@ class App extends Component {
6574

6675
async login() {
6776
try {
68-
await this.userAgentApplication.loginPopup(config.scopes);
77+
await this.userAgentApplication.loginPopup(
78+
{
79+
scopes: config.scopes,
80+
prompt: "select_account",
81+
});
6982
await this.getUserProfile();
7083
}
7184
catch(err) {
@@ -89,7 +102,9 @@ class App extends Component {
89102
// will just return the cached token. Otherwise, it will
90103
// make a request to the Azure OAuth endpoint to get a token
91104

92-
var accessToken = await this.userAgentApplication.acquireTokenSilent(config.scopes);
105+
var accessToken = await this.userAgentApplication.acquireTokenSilent({
106+
scopes: config.scopes
107+
});
93108

94109
if (accessToken) {
95110
// Get the user's profile from Graph

demos/02-add-aad-auth/graph-tutorial/src/GraphService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function getAuthenticatedClient(accessToken) {
66
// Use the provided access token to authenticate
77
// requests
88
authProvider: (done) => {
9-
done(null, accessToken);
9+
done(null, accessToken.accessToken);
1010
}
1111
});
1212

0 commit comments

Comments
 (0)