OfficeRuntime.Auth interface
Interface that contains authorization related APIs.
Remarks
The methods in this interface are equivalent to those in the Office.auth interface. If new authentication types are added in the future, they will only be added to the Office.auth
interface. For simplicity, the code examples throughout the documentation use Office.auth
.
Methods
get |
Calls the Azure Active Directory V 2.0 endpoint to get an access token to your add-in's web application. Enables add-ins to identify users. Server-side code can use this token to access Microsoft Graph for the add-in's web application by using the "on behalf of" OAuth flow. This API requires a single sign-on configuration that bridges the add-in to an Azure application. Office users sign-in with Organizational Accounts and Microsoft Accounts. Microsoft Azure returns tokens intended for both user account types to access resources in the Microsoft Graph. Important: In Outlook, this API isn't supported if the add-in is loaded in an Outlook.com or Gmail mailbox. |
Method Details
getAccessToken(options)
Calls the Azure Active Directory V 2.0 endpoint to get an access token to your add-in's web application. Enables add-ins to identify users. Server-side code can use this token to access Microsoft Graph for the add-in's web application by using the "on behalf of" OAuth flow. This API requires a single sign-on configuration that bridges the add-in to an Azure application. Office users sign-in with Organizational Accounts and Microsoft Accounts. Microsoft Azure returns tokens intended for both user account types to access resources in the Microsoft Graph.
Important: In Outlook, this API isn't supported if the add-in is loaded in an Outlook.com or Gmail mailbox.
getAccessToken(options?: AuthOptions): Promise<string>;
Parameters
- options
- OfficeRuntime.AuthOptions
Optional. Accepts an AuthOptions
object to define sign-on behaviors.
Returns
Promise<string>
Promise to the access token.
Remarks
Applications: Excel, Outlook, PowerPoint, Word
Feedback
Submit and view feedback for