Take the 2-minute tour ×

I'm creating my first app for SharePoint 2013. I follow this MSDN article, that explains how to create autohosted app.

This piece of code I took from the article and didn't change anything in it.

protected void Page_Load(object sender, EventArgs e)
    string contextTokenString = TokenHelper.GetContextTokenFromRequest(Request);

    if (contextTokenString != null)
        // Get context token
        contextToken = TokenHelper.ReadAndValidateContextToken(contextTokenString, Request.Url.Authority);

        // Get access token
        accessToken = TokenHelper.GetAccessToken(contextToken, sharepointUrl.Authority).AccessToken;

        // Pass the access token to the button event handler.
        Button1.CommandArgument = accessToken;

However, when I run my deployed app, I get SecurityTokenException: Invalid issuer or signature.

Any advice how to solve this error would be appreciated.

 [SecurityTokenException: Invalid issuer or signature.]
   Microsoft.IdentityModel.S2S.Tokens.JsonWebSecurityTokenHandler.VerifySignature(String signingInput, String signature, String algorithm, SecurityToken signingToken) +873
   Microsoft.IdentityModel.S2S.Tokens.JsonWebSecurityTokenHandler.ReadTokenCore(String token, Boolean isActorToken) +498
   Microsoft.IdentityModel.S2S.Tokens.JsonWebSecurityTokenHandler.ReadToken(String token) +7
   SharePoint_AutohostedApp1Web.TokenHelper.ReadAndValidateContextToken(String contextTokenString, String appHostName) in c:\Users\tsch\Documents\Visual Studio 2012\Projects\SharePoint-AutohostedApp1\SharePoint-AutohostedApp1Web\TokenHelper.cs:75
   SharePoint_AutohostedApp1Web.Pages.Default.Page_Load(Object sender, EventArgs e) in c:\Users\tsch\Documents\Visual Studio 2012\Projects\SharePoint-AutohostedApp1\SharePoint-AutohostedApp1Web\Pages\Default.aspx.cs:24
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +92
   System.Web.UI.Control.LoadRecursive() +54
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
share|improve this question
Tschareck, could you post what you did to solve this issue. I'm running into same issue deploying the same demo app and haven't found a fix yet. Thanks –  Dave Jorgensen Jan 8 '13 at 23:37
add comment

1 Answer

I'm assuming you have already found a way around this issue, but I resolved it by editing the permissions my App needed to the Host Web. Originally I was just leaving it blank, but setting those permissions explicitly in the manifest got it working.

share|improve this answer
this did it for me. I constantly am forgetting to request access to the web. Weird for me is that I was able to connect without the permission, then it magically stopped working. –  Tim Gabrhel Feb 6 '13 at 5:26
My comment doesn't stand entirely. This seems to be a caching issue perhaps. –  Tim Gabrhel Feb 6 '13 at 6:20
add comment

Your Answer


