OfficeDev / Office-Addin-Scripts

A set of scripts and packages that are consumed in Office add-ins projects.
MIT License
152 stars 93 forks source link

getGraphToken is missing #827

Closed Edward-Zhou closed 5 months ago

Edward-Zhou commented 5 months ago

I am referencing TrainingContent to call graph from excel web addin.

There is code snippet like below:

    let bootstrapToken = await OfficeRuntime.auth.getAccessToken({ allowSignInPrompt: true });
    let exchangeResponse = await sso.getGraphToken(bootstrapToken);
    if (exchangeResponse.claims) {
      // Microsoft Graph requires an additional form of authentication. Have the Office host
      // get a new token using the Claims string, which tells AAD to prompt the user for all
      // required forms of authentication.
      let mfaBootstrapToken = await OfficeRuntime.auth.getAccessToken({ authChallenge: exchangeResponse.claims });
      exchangeResponse = sso.getGraphToken(mfaBootstrapToken);
    }

But, getGraphToken does not exist in latest office-addin-sso

millerds commented 5 months ago

That training is out of date. The getGraphToken call was removed almost a year and a half ago because it promoted poor practices for keeping token secured. It was done in conjunctions with updates to the project generated with 'yo office' that was also updated to encourage more secure token handling.

That specific training content needs to be updated. I can't transfer this issue to there . . . so please create a new issure in that repo.