Skip to content
This repository was archived by the owner on May 3, 2024. It is now read-only.

Commit ee2aea9

Browse files
committed
mior updates to CA
1 parent 005748f commit ee2aea9

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

6-AdvancedScenarios/1-call-api-obo/API/auth/claimUtils.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ const generateClaimsChallenge = (claims) => {
2222
const clientId = authConfig.credentials.clientID;
2323

2424
// base64 encode the challenge object
25-
const base64str = Buffer.from(JSON.stringify(claims)).toString('base64');
25+
let bufferObj = Buffer.from(claims, 'utf8');
26+
let base64str = bufferObj.toString('base64');
2627
const headers = ["WWW-Authenticate", "Bearer realm=\"\", authorization_uri=\"https://login.microsoftonline.com/common/oauth2/v2.0/authorize\", client_id=\"" + clientId + "\", error=\"insufficient_claims\", claims=\"" + base64str + "\""];
2728

2829
return {

6-AdvancedScenarios/1-call-api-obo/SPA/src/pages/Profile.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ const ProfileContent = () => {
5353
callApiWithToken(result.accessToken, protectedResources.apiHello.endpoint, account)
5454
.then((response) => setGraphData(response))
5555
.catch((error) => {
56-
if (error.errorMessage === 'claims_challenge_occurred') {
56+
if (error.message === 'claims_challenge_occurred') {
5757
login(InteractionType.Redirect, request);
5858
} else {
5959
console.log(error);
60-
setGraphData(error)
60+
setGraphData(error);
6161
}
6262
});
6363
}

0 commit comments

Comments
 (0)