- (Exam Topic 2)
You are developing a single-page application (SPA).
You plan to access user data from Microsoft Graph by using an AJAX call.
You need to obtain an access token by the Microsoft Authentication Library (MSAL). The solution must minimize authentication prompts.
How should you complete the code segment? To answer, select the appropriate options in the answer area. NOTE: Each correct selection is worth one point.
Solution:
Box 1: loginPopup
Box 2: acquireTokenSilent
The pattern for acquiring tokens for APIs with MSAL.js is to first attempt a silent token request by using the acquireTokenSilent method. When this method is called, the library first checks the cache in browser storage to see if a valid token exists and returns it. When no valid token is in the cache, it sends a silent token request to Azure Active Directory (Azure AD) from a hidden iframe. This method also allows the library to renew tokens.
Box 3: acquireTokenPopup
//AcquireToken Failure, send an interactive request. Example:
userAgentApplication.loginPopup(applicationConfig.graphScopes).then(function (idToken) {
//Login Success
userAgentApplication.acquireTokenSilent(applicationConfig.graphScopes).then(function (accessToken) {
//AcquireToken Success updateUI();
}, function (error) {
//AcquireToken Failure, send an interactive request. userAgentApplication.acquireTokenPopup(applicationConfig.graphScopes).then(function (accessToken) { updateUI();
}, function (error) { console.log(error);
});
})
}, function (error) { console.log(error);
});
Reference: https://github.com/AzureAD/microsoft-authentication-library-for-js/issues/339
Does this meet the goal?
Correct Answer:A
- (Exam Topic 2)
You need to request permission to create a group in a Sharepoint Framework (SPFx) solution. To which file should you add the permission request?
Correct Answer:D
- (Exam Topic 2)
You have a SharePoint Framework (SPFx) web part that displays the weather. Users can set the city within the web part. Which component is invoked to provide the users with the ability to configure the settings for the web part?
Correct Answer:B
- (Exam Topic 1)
How can you validate that the JSON notification message is sent from the Microsoft Graph service?
Correct Answer:A
clientState specifies the value of the clientState property sent by the service in each notification. The maximum length is 128 characters. The client can check that the notification came from the service by comparing the value of the clientState property sent with the subscription with the value of the clientState property received with each notification.
Note: A subscription allows a client app to receive notifications about changes to data in Microsoft Graph. Reference: https://docs.microsoft.com/en-us/graph/api/resources/subscription
- (Exam Topic 2)
You have an application that employees use to schedule vacations. The application sets an automatic reply and an out-of-off event in the employees’ Microsoft 365 calender.
Employees who access the application from a mobile device report that the application is slow to make changes.
You need to replace the application calls to use batched request. Automatic reply must be set only if an out-of-office event is set successfully.
How should you complete the batch request? To answer, select the appropriate options in the answer area.
Solution:
Does this meet the goal?
Correct Answer:A