4

I have a Sharepoint 2013 on premise environment for which I am developing an provider hosted app using Visual Studio.

The Visual Studio project has an app project which contains a custom ribbon button that goes to the web project. The web project is hosted on Windows Azure where I made a website for the project to be hosted on.

When clicking the button in SharePoint it goes to the website on Azure and here I get the error that the context token is null or an empty string.

Getting the token is done using the following code:

var contextTokenString = TokenHelper.GetContextTokenFromRequest(Request);
SharePointContextToken contextToken =
TokenHelper.ReadAndValidateContextToken(contextTokenString, Request.Url.Authority);

When I see what is passed to the site hosted on Azure I notice that the SPAppToken is null. When using ULS viewer I get the error "The Azure Access Control service is unavailable"

I have already checked if the app is registered (using appregnew.aspx) and that the id is the same for this and in the appManifest.xml and web.config files.

How do I get the context token? Do I need to do something else in Azure in order to make it work?

  • 1
    Any news ? Did you resolve this problem ? – Philippe Lavoie Nov 11 '13 at 17:48
2

Yes, actually it is not so easy to accomplish this. to put it in a nutshell your app and your SharePoint both need to trust the same Authentication Provider. Like Azure Access Control or ADFS. Because they will genearte the token AFAIK. Provider hosted apps without an Auth Provider will only work in a Server 2 Server Trust Relationship as mentioned before by Supermode

0

This link would definitely help you http://blogs.technet.com/b/speschka/archive/2012/11/01/more-troubleshooting-tips-for-high-trust-apps-on-sharepoint-2013.aspx

0

Just in case you are targeting sharepoint online and not on-premises, make sure that your URL's are HTTPS:// and not HTTP://.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.