How to call MSAL with the help of `Office.auth.getAuthContext()` response?

Suraj Sinha 5 Reputation points
2024-11-19T07:59:25.4066667+00:00

In Microsoft documentation for the Office.auth.getAuthContext() method, it mentions:

"Gets information about the signed-in user. The add-in can pass this information to the Microsoft Authentication Library (MSAL.js) to get an access token for the current session."User's image

When you call Office.auth.getAuthContext(), it provides the following details:

{authorityBaseUrl:"https://login.windows.net"`

authorityType: "aad"

loginHint: "suraj.sinha@xyz.com"

tenantId: "abcd"

userObjectId: "xyz"

userPrincipalName: "suraj.sinha@xyz.com" }

How can this response from Office.auth.getAuthContext() be utilized in MSAL.js to acquire an access token?

Office
Office
A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.
1,743 questions
Outlook
Outlook
A family of Microsoft email and calendar products.
4,080 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,371 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
4,024 questions
Outlook Management
Outlook Management
Outlook: A family of Microsoft email and calendar products.Management: The act or process of organizing, handling, directing or controlling something.
5,301 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.