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
Copy file name to clipboardExpand all lines: docs/sp-add-ins/handle-security-tokens-in-provider-hosted-low-trust-sharepoint-add-ins.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -106,7 +106,7 @@ The following is a decoded example of a user+add-in access token generated by AC
106
106
107
107
Note that all the values must be lowercase. (User+add-in access tokens are the same in the [Context Token flow](context-token-oauth-flow-for-sharepoint-add-ins.md) and the [Authorization Code flow](authorization-code-oauth-flow-for-sharepoint-add-ins.md).)
@@ -138,7 +138,7 @@ Note that all the values must be lowercase. (User+add-in access tokens are the s
138
138
139
139
The following is a decoded example of an add-in-only access token generated by ACS to be used for calls to SharePoint using the [add-in-only policy](add-in-authorization-policy-types-in-sharepoint.md). White space has been added for readability. The token complies with the [JSON Web Token](https://datatracker.ietf.org/doc/rfc7519/) protocol. See Table 2 for details about the properties in the claim set. (The add-in-only policy is not available for applications that use the [Authorization Code flow](authorization-code-oauth-flow-for-sharepoint-add-ins.md), because they do not have an add-in manifest file and, thus, cannot request permission to use add-in-only calls.)
@@ -283,7 +283,7 @@ Response.Redirect(TokenHelper.GetAppContextTokenRequestUrl(sharePointUrl, Server
283
283
284
284
The following is an example of a context token. The small JavaScript Object Notation (JSON) object at the top contains metadata about the token. These properties are the same as in access tokens (see earlier). The value of the **alg** property is the name of the algorithm that is used to generate the signature that ACS appends to the token. See Table 3 for details about the properties in the payload of the token. Note that all the values must be lowercase. (White space has been added for readability.)
description: Use the Fiddler tool and other guidance for resolving high-trust issues.
4
+
ms.date: 12/29/2017
4
5
ms.prod: sharepoint
5
6
---
6
7
7
8
8
9
# Troubleshooting high-trust SharePoint Add-ins
9
-
Get some help with problems developing high-trust SharePoint Add-ins.
10
-
11
-
12
-
13
-
14
-
This article describes the Fiddler tool and also provides some guidance for resolving some specific issues.
15
-
16
10
17
11
## Use the Fiddler tool
18
12
19
-
The free [Fiddler tool](http://www.telerik.com/fiddler) can be used to capture the HTTP Requests sent by the remote component of your add-in to SharePoint. There is a [free extension to the tool](https://github.com/andrewconnell/SPOAuthFiddlerExt) that automatically decodes the access tokens in the requests.
20
-
13
+
The free [Fiddler tool](http://www.telerik.com/fiddler) can be used to capture the HTTP Requests sent by the remote component of your add-in to SharePoint.
14
+
15
+
There is a [free extension to the tool](https://github.com/andrewconnell/SPOAuthFiddlerExt) that automatically decodes the access tokens in the requests.
21
16
22
-
23
17
After you have installed Fiddler on the web application server, add the following markup to your web.config file to make requests from your remote web app go through this proxy. This way, you can capture a Fiddler trace and see the full response from SharePoint when you get an error.
24
18
25
19
> [!NOTE]
26
20
> Ensure that you remove this markup if you are not running Fiddler. If you don't remove the markup, your add-in won't be able to make HTTP requests.
27
-
28
-
29
-
30
-
31
21
32
22
```XML
33
23
<system.net>
@@ -38,18 +28,14 @@ After you have installed Fiddler on the web application server, add the followin
38
28
39
29
```
40
30
41
-
After you have Fiddler installed, you can also check the response headers from SharePoint, which will include a request GUID. This request GUID is a correlation ID you can look up in the logs to find any log errors associated with that request.
31
+
After you have Fiddler installed, you can also check the response headers from SharePoint, which include a request GUID. This request GUID is a correlation ID that you can look up in the logs to find any log errors associated with that request.
42
32
43
33
44
-
34
+
<aname="UnauthorizedException"> </a>
45
35
46
36
## 401 Unauthorized error
47
-
<aname="UnauthorizedException"> </a>
48
-
49
-
Several things can cause a **401 Unauthorized** error when the high-trust add-in first accesses SharePoint. If you are using the Client-side Object Model (CSOM), the error looks something like the following:
50
-
51
37
52
-
38
+
Several things can cause a **401 Unauthorized** error when the high-trust add-in first accesses SharePoint. If you are using the Client-side Object Model (CSOM), the error looks something like the following:
Your first step in troubleshooting the issue is to use the Visual Studio debugger to verify that the access token and the **ClientContext** object are constructed successfully. If they are, investigate the following possibilities:
82
-
83
-
84
-
85
-
**Possible issues and resolution:**
86
-
87
-
62
+
Your first step in troubleshooting the issue is to use the Visual Studio debugger to verify that the access token and the **ClientContext** object are constructed successfully. If they are, investigate the following possibilities:
88
63
64
+
**Possible issue and resolution**:
89
65
90
66
- There is no user profile created for the user who is accessing the remote web application. Create the user profile.
91
67
92
-
93
-
- Your add-in does not have permission to the resource you are trying to access. Open the SharePoint Management Shell and run that the following Windows PowerShell cmdlet. The variable `$web` is the SharePoint website you are trying to get access to and `$appPrincipal`) is the add-in ID. For more information, see [Set-SPAppPrincipalPermission](http://technet.microsoft.com/en-us/library/jj219714%28v=office.15%29.aspx).
94
-
95
-
```
96
-
Set-SPAppPrincipalPermission -Site $web -AppPrincipal $appPrincipal -Scope Site -Right FullControl
97
-
```
68
+
- Your add-in does not have permission to the resource you are trying to access. Open the SharePoint Management Shell and run the following Windows PowerShell cmdlet. The variable `$web` is the SharePoint website you are trying to get access to, and `$appPrincipal` is the add-in ID. For more information, see [Set-SPAppPrincipalPermission](https://docs.microsoft.com/en-us/powershell/module/sharepoint-server/Set-SPAppPrincipalPermission?view=sharepoint-ps).
69
+
70
+
```powershell
71
+
Set-SPAppPrincipalPermission -Site $web -AppPrincipal $appPrincipal -Scope Site -Right FullControl
72
+
```
98
73
99
-
- Your web application is accepting anonymous requests. This means there is not a real user identity in the access token. Ensure that anonymous access has been disabled in IIS for the root directory of your remote web application. You can also check this by debugging your remote web application, and checking the value of **Request.LogonUserIdentity** in the default.aspx.cs (or .vb) file to ensure that it's not an anonymous user.
100
-
74
+
- Your web application is accepting anonymous requests. This means there is not a real user identity in the access token. Ensure that anonymous access has been disabled in IIS for the root directory of your remote web application. You can also check this by debugging your remote web application, and checking the value of **Request.LogonUserIdentity** in the default.aspx.cs (or .vb) file to ensure that it's not an anonymous user.
101
75
102
76
- Your digital certificate was not added to the trusted certificate store. Be sure you have followed the procedures in [Package and publish high-trust SharePoint Add-ins](package-and-publish-high-trust-sharepoint-add-ins.md).
103
77
104
-
78
+
<aname="DomainRelatedErrors"> </a>
105
79
106
80
## Miscellaneous SSL and ___domain-related authorization errors
107
-
<aname="DomainRelatedErrors"> </a>
108
81
109
82
A mismatch of ___domain names in configuration files and registration forms can prevent authorization. The following four values have to be exactly the same:
110
-
111
83
84
+
- The **Add-in Domain** that is specified when the SharePoint Add-in is registered on AppRegNew.aspx.
112
85
113
-
114
-
- The **Add-in Domain** that is specified when the SharePoint Add-in is registered on AppRegNew.aspx.
115
-
116
-
117
-
- The ___domain under which the remote web application's security certificate is registered.
118
-
86
+
- The ___domain under which the remote web application's security certificate is registered.
119
87
120
-
- The ___domain part of the **StartPage** value in the AppManifest.xml file.
121
-
88
+
- The ___domain part of the **StartPage** value in the AppManifest.xml file.
122
89
123
-
- The ___domain part of the URLs of any event receivers specified in the AppManifest.xml.
124
-
90
+
- The ___domain part of the URLs of any event receivers specified in the AppManifest.xml.
125
91
126
92
In connection with this point, note the following:
127
-
128
93
129
-
94
+
- If the remote component of your SharePoint Add-in is using any port other than 443, you must explicitly include the port as part of the ___domain in all four places; for example, `MarketingServer:3333`. (You must use the HTTPS protocol, for which the default port is 443.)
130
95
131
-
-If the remote component of your SharePoint Add-in is using any port other than 443, you must explicitly include the port as part of the ___domain in all four places; for example, `MarketingServer:3333`. (You must use the HTTPS protocol for which the default port is 443.)
96
+
-The ___domain needs to be hardcoded in the **StartPage** value (and any event receiver URLs) of the AppManifest.xml file before the add-in is packaged. If you use the Publish Wizard in Visual Studio to package the add-in, you are prompted for the ___domain, and the Office Developer Tools for Visual Studio inserts it into the **StartPage** value for you (in place of the `~remoteWebUrl` token that is used during debugging. But if you are not using the Publish Wizard, you must manually replace the token with the ___domain (and protocol); for example `https://MarketingServer` or `https://MarketingServer:3333`.
132
97
133
-
134
-
- The ___domain needs to be hardcoded in the **StartPage** value (and any event receiver URLs) of the AppManifest.xml file before the add-in is packaged. If you use the **Publish** wizard in Visual Studio to package the add-in, you will be prompted for the ___domain and the Office Developer Tools for Visual Studio will insert it into the **StartPage** value for you (in place of the `~remoteWebUrl` token that is used during debugging. But if you are not using the **Publish** wizard you must manually replace the token with the ___domain (and protocol); for example `https://MarketingServer` or `https://MarketingServer:3333`.
135
-
136
-
98
+
<aname="DomainRelatedErrors"> </a>
137
99
138
100
## Runtime error saying that there's no certificate with that serial number
139
-
<aname="DomainRelatedErrors"> </a>
140
101
141
-
If you are sure you have the correct certificate serial number in the web.config and you can see the certificate in the **Windows Certificate Store**, then there may be a hidden extra character in the serial number in the web.config. This will happen if the serial number is copy'n'pasted from the **Microsoft Management Console**. Delete the entire serial number value from the web.config and *manually* retype it.
102
+
If you are sure you have the correct certificate serial number in the web.config, and you can see the certificate in the Windows Certificate Store, there may be a hidden extra character in the serial number in the web.config. This happens if the serial number is copied and pasted from the Microsoft Management Console. Delete the entire serial number value from the web.config and *manually* retype it.
0 commit comments