You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Outlook](Exchange tokens) Update FAQ for ID token scenarios (#5086)
* clarify id token usage scenarios
* Apply suggestions from code review
Co-authored-by: Alex Jerabek <[email protected]>
* Update docs/outlook/faq-nested-app-auth-outlook-legacy-tokens.md
Co-authored-by: Alex Jerabek <[email protected]>
* minor edit
* minor edit
* minor edit
---------
Co-authored-by: Alex Jerabek <[email protected]>
Copy file name to clipboardExpand all lines: docs/outlook/faq-nested-app-auth-outlook-legacy-tokens.md
+24-12Lines changed: 24 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: Nested app authentication and Outlook legacy tokens deprecation FAQ
4
4
ms.service: microsoft-365
5
5
ms.subservice: add-ins
6
6
ms.topic: faq
7
-
ms.date: 03/11/2025
7
+
ms.date: 03/13/2025
8
8
---
9
9
10
10
# Nested app authentication and Outlook legacy tokens deprecation FAQ
@@ -181,6 +181,11 @@ If legacy Exchange Online tokens are off, you'll see an error displayed in the c
181
181
182
182

183
183
184
+
The actual error and code can vary, but often you will see error code 9017 or 9018 along with the following error descriptions.
185
+
186
+
-`GenericTokenError: An internal error has occurred.`
187
+
-`InternalServerError: The Exchange server returned an error. Please look at the diagnostics object for more information.`
188
+
184
189
If an add-in is affected by Exchange tokens turned off, you can turn them back on. For more information, see [Can I turn Exchange Online legacy tokens back on?](#can-i-turn-exchange-online-legacy-tokens-back-on).
185
190
186
191
## Outlook add-in migration FAQ
@@ -210,7 +215,10 @@ If your add-in is for Exchange on-premises only (for example, Exchange 2019), it
210
215
211
216
### What will happen to my Outlook add-ins if I don't migrate to NAA?
212
217
213
-
If you don't migrate your Outlook add-ins to NAA, they'll stop working as expected in Exchange Online. When Exchange tokens are turned off, Exchange Online will block legacy token issuance. Any add-in that uses legacy tokens won't be able to access Exchange online resources.
218
+
If you don't migrate your Outlook add-ins to NAA, they'll stop working as expected in Exchange Online. When Exchange tokens are turned off, Exchange Online will block legacy token issuance. Any add-in that uses legacy tokens won't be able to access Exchange online resources. When your add-in calls an API that requests an Exchange token, such as `getUserIdentityTokenAsync`, it gets a generic error similar to the following with error codes such as 9017 or 9018.
219
+
220
+
- "GenericTokenError: An internal error has occurred."
221
+
- "InternalServerError: The Exchange server returned an error. Please look at the diagnostics object for more information."
214
222
215
223
If your add-in only works on-premises or if your add-in is on a deprecation path, you may not need to update. However, most add-ins that access Exchange resources through EWS or Outlook REST must migrate to continue functioning as expected.
216
224
@@ -294,29 +302,33 @@ Outlook 2016 and Outlook 2019 on Windows use the Trident+ or WebView2 based on v
294
302
- For more information on when Trident+ or Webview2 is used, see [Browsers and webview controls used by Office Add-ins](../concepts/browsers-used-by-office-web-add-ins.md).
295
303
- For more information on how to determine which webview is running, see [Support older Microsoft webviews and Office versions](../develop/support-ie-11.md#determine-the-webview-the-add-in-is-running-in-at-runtime)
296
304
297
-
### How do I validate the ID token or authenticate the user?
298
-
299
-
Using Exchange tokens, you can validate the ID token and use it to authorize the user to access your own resources. For more information, see [Authenticate a user with an identity token for Exchange](authenticate-a-user-with-an-identity-token.md). However, MSAL with Entra ID tokens does not use this approach.
305
+
### What tokens does MSAL return and are there minimum scopes to request?
300
306
301
307
When you request a token through MSAL, it always returns three tokens.
302
308
303
-
|Token |Purpose |Scopes |
304
-
|---------------|---------|---------|
305
-
|ID token | Provides information about the user to the client (task pane). |`profile` and `openid`|
306
-
|Refresh token | Refreshes the ID and access tokens when they expire. |`offline_access`|
307
-
|Access token | Authenticates the user for specific scopes to a resource, such as Microsoft Graph. | Any resource scopes, such as `user.read`. |
|ID token | Provides information about the user to the client (task pane). |`profile` and `openid`|`authResult.idToken`|
312
+
|Refresh token | Refreshes the ID and access tokens when they expire. |`offline_access`| Not available. |
313
+
|Access token | Authenticates the user for specific scopes to a resource, such as Microsoft Graph. | Any resource scopes, such as `user.read`. |`authResult.accessToken`|
308
314
309
315
MSAL always returns these three tokens. It requests the `profile`, `openid`, and `offline_access` as default scopes even if your token request doesn't include them. This ensures the ID and refresh tokens are requested. However, you must include at least one resource scope, such as `user.read` so that you get an access token. If not, the request can fail.
310
316
311
-
Passing the ID token over a network call to enable or authorize access to a service is a security anti-pattern. The token is intended only for the client (task pane) and there is no way for the service to reliably use the token to be sure the user has authorized access. For more information about ID token claims, see [https://learn.microsoft.com/en-us/entra/identity-platform/id-token-claims-reference](/entra/identity-platform/id-token-claims-reference).
317
+
### Should I validate the ID token from MSAL?
318
+
319
+
No. This is a legacy authentication pattern that was used with Exchange tokens to authorize access to your own resources. Passing the ID token over a network call to enable or authorize access to a service is a security anti-pattern. The ID token is intended only for the client (task pane) and there is no way for the service to reliably use the token to be sure the user has authorized access. For more information about ID token claims, see [ID token claims reference](/entra/identity-platform/id-token-claims-reference).
312
320
313
321
It's very important that you always request an access token to your own services. The access token also includes the same ID claims, so you don't need to pass the ID token. Instead create a custom scope for your service. For more information about app registration settings for your own services, see [Protected web API: App registration](/entra/identity-platform/scenario-protected-web-api-app-registration). When your service receives the access token, it can validate it, and use ID claims from inside the access token.
314
322
323
+
### Why is the ID token not refreshed?
324
+
325
+
There is a known issue where MSAL sometimes doesn't refresh the ID token after it expires. This shouldn't cause any issues in your add-in since the ID token is only intended for use in your task pane to get basic user identity information, such as name and email. There's no reason to validate the ID token or check the expiration claim. If you need to authenticate the user to your own resources, use the access token which also contains user identity information. The ID token must never be passed outside of your client code that received it.
326
+
315
327
### How do I determine if the user is an online or on-premise account?
316
328
317
329
You can determine if the signed-in user has an Exchange Online account or on-premise Exchange account by using the [Office.UserProfile.accountType](/javascript/api/outlook/office.userprofile) property. If the account type property value is **enterprise**, then the mailbox is on an on-premises Exchange server. Note that volume-licensed perpetual Outlook 2016 doesn’t support the **accountType** property. To work around this, call the [ResolveNames](/exchange/client-developer/web-service-reference/resolvenames-operation) operation in Exchange Web Service (EWS) in the Exchange on-premise server to get the recipient types.
318
330
319
-
## How do I deploy my add-in to Microsoft AppSource
331
+
###How do I deploy my add-in to Microsoft AppSource
320
332
321
333
If you're publishing a new add-in to Microsoft AppSource, it will need to go through a certification process. For more information, see [Publish your Office Add-in to Microsoft AppSource](../publish/publish-office-add-ins-to-appsource.md). If you're updating the manifest of an add-in that is already published to Microsoft AppSource, you need to go through the certification process again. You can update the add-in's source code on your web server any time without a need to go through the certification process.
0 commit comments