mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Merge pull request #28573 from Goldensky321/master
Remove Office.js SSO API in intellisense
This commit is contained in:
58
types/office-js/index.d.ts
vendored
58
types/office-js/index.d.ts
vendored
@@ -639,10 +639,6 @@ declare namespace Office {
|
||||
* <table><tr><td>Hosts</td><td>Access, Excel, Outlook, PowerPoint, Project, Word </td></tr></table>
|
||||
*/
|
||||
interface Context {
|
||||
/**
|
||||
* Provides information and access to the signed-in user.
|
||||
*/
|
||||
auth: Auth;
|
||||
/**
|
||||
* True, if the current platform allows the add-in to display a UI for selling or upgrading; otherwise returns False.
|
||||
*
|
||||
@@ -1131,60 +1127,6 @@ declare namespace Office {
|
||||
*/
|
||||
asyncContext?: any
|
||||
}
|
||||
/**
|
||||
* The Office Auth namespace, Office.context.auth, provides a method that allows the Office host to obtain an access token to the add-in's web application.
|
||||
* Indirectly, this also enables the add-in to access the signed-in user's Microsoft Graph data without requiring the user to sign in a second time.
|
||||
*
|
||||
* @beta
|
||||
*/
|
||||
interface Auth {
|
||||
/**
|
||||
* 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
|
||||
* {@link https://docs.microsoft.com/azure/active-directory/develop/active-directory-v2-protocols-oauth-on-behalf-of | "on behalf of" OAuth flow}.
|
||||
*
|
||||
* Important: In Outlook, this API is not supported if the add-in is loaded in an Outlook.com or Gmail mailbox.
|
||||
*
|
||||
* @remarks
|
||||
* <table><tr><td>Hosts</td><td>Excel, OneNote, Outlook, PowerPoint, Word</td></tr>
|
||||
*
|
||||
* <tr><td>Requirement sets</td><td>{@link https://docs.microsoft.com/office/dev/add-ins/develop/specify-office-hosts-and-api-requirements | IdentityAPI}</td></tr></table>
|
||||
*
|
||||
* @param options - Optional. Accepts an AuthOptions object to define sign-on behaviors.
|
||||
* @param callback - Optional. Accepts a callback method that can parse the token for the user's ID or use the token in the "on behalf of" flow to get access to Microsoft Graph.
|
||||
* If AsyncResult.status is "succeeded", then AsyncResult.value is the raw AAD v. 2.0-formatted access token.
|
||||
*
|
||||
* @beta
|
||||
*/
|
||||
getAccessTokenAsync(options?: AuthOptions, callback?: (result: AsyncResult<string>) => void): void;
|
||||
|
||||
}
|
||||
/**
|
||||
* Provides options for the user experience when Office obtains an access token to the add-in from AAD v. 2.0 with the getAccessTokenAsync method.
|
||||
*/
|
||||
interface AuthOptions {
|
||||
/**
|
||||
* Causes Office to display the add-in consent experience. Useful if the add-in's Azure permissions have changed or if the user's consent has
|
||||
* been revoked.
|
||||
*/
|
||||
forceConsent?: boolean,
|
||||
/**
|
||||
* Prompts the user to add their Office account (or to switch to it, if it is already added).
|
||||
*/
|
||||
forceAddAccount?: boolean,
|
||||
/**
|
||||
* Causes Office to prompt the user to provide the additional factor when the tenancy being targeted by Microsoft Graph requires multifactor
|
||||
* authentication. The string value identifies the type of additional factor that is required. In most cases, you won't know at development
|
||||
* time whether the user's tenant requires an additional factor or what the string should be. So this option would be used in a "second try"
|
||||
* call of getAccessTokenAsync after Microsoft Graph has sent an error requesting the additional factor and containing the string that should
|
||||
* be used with the authChallenge option.
|
||||
*/
|
||||
authChallenge?: string
|
||||
/**
|
||||
* A user-defined item of any type that is returned, unchanged, in the asyncContext property of the AsyncResult object that is passed to a callback.
|
||||
*/
|
||||
asyncContext?: any
|
||||
}
|
||||
/**
|
||||
* Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
*/
|
||||
|
||||
@@ -250,22 +250,6 @@ function test_word() {
|
||||
|
||||
}
|
||||
|
||||
function test_shared() {
|
||||
Office.context.auth.getAccessTokenAsync({ forceConsent: false },
|
||||
function (result) {
|
||||
if (result.status === Office.AsyncResultStatus.Succeeded) {
|
||||
// result.value is the raw access token
|
||||
console.log(result.value)
|
||||
}
|
||||
else {
|
||||
console.log("Code: " + result.error.code);
|
||||
console.log("Message: " + result.error.message);
|
||||
console.log("name: " + result.error.name);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
async function test_visio() {
|
||||
const url = "someurl";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user