I created a new Project for Sharepoint 2013 Apps in the Visual Studio 12. I choosed autohosted and added the link to my SP Web Home Site. I also added:

<AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="Read" />

in the AppManifest.

So why is the method TokenHelper.GetContextTokenFromRequet in the Default.aspx.cs always returning null?

  • Im facing the same issue. However i have narrowed down the issue. If i open the page in modal dialog than GetContextTokenFromRequet returns always null. otherwise it is fine. The reason is request.Form["SPAppToken"] is null. Can somebody tell me the solution for this
    – user19090
    Nov 22 '13 at 6:40
  • are you trying for custom STS ?
    – Nikhil J
    Apr 10 '14 at 0:44

I don't know your sharepoint app is secure or not. I had same problem. fixed by updating start-up page from http:// to https:// in AppManifest.xml



Are you trying to deploy your app to Office 365 or an on-premises environment? If you are on-premises, you cannot use an Autohosted app. Instead, you will need to:

  • Configure a public and private test certificate for your environment (if you don't have Azure ACS configured)
  • Configure app isolation
  • Run some PowerShell cmdlets
  • (Optionally) Turn off the HTTPS requirement for OAuth in your dev environment
  • Create a new provider-hosted app in Visual Studio, configured to use a certificate for authentication

These steps are spelled out in much greater detail in the second half of this article. I have verified that they work with Preview 2 of the Microsoft Office Developer Tools for Visual Studio 2012, available for download here. (I mention this because Preview 2 of the Office Dev Tools was released after you posted this question.)

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.