1

I created a new app by following this tutorial

http://blogs.msdn.com/b/bspann/archive/2013/01/19/asp-net-mvc-based-apps-for-sharepoint-2013-on-premises.aspx

I was able to press F5 and it showed me the Do you Trust it screen, and I installed.

Code is like this:

public ActionResult Index()
        {
            Uri hostWeb = new Uri(Request.QueryString["SPHostUrl"]);
            using (
                var clientContext = TokenHelper.GetS2SClientContextWithWindowsIdentity(hostWeb,
                    Request.LogonUserIdentity))
            {
                var web = clientContext.Web;
                clientContext.Load(web, w=>w.Lists.Include(l=>l.Title).Where(l=>!l.Hidden));
                clientContext.ExecuteQuery();

                return View(web.Lists);
            }
        }

I checked the HOST WEB and my username is on the Owners group. I debuggeed and Request.LogonUnserIdentity is showing my username, so that means the app is being executed under my identity which is ok

Whats happening then?

I noticed that when do F5, the url in ths browser is with localhost I had to replace it because this site wont let me put localhost, looool!

https://mysuperxxxxx.com:44301/Home?SPHostUrl=http%3A%2F%2Fbe%2Dappsdev003%2Ebe%2Eema%2Emycompanynameinternal%2Ecom&SPLanguage=en%2DUS&SPClientTag=0&SPProductNumber=15%2E0%2E4481%2E1005

I found this on my ULS Logs

SPApplicationAuthenticationModule: Error authenticating request, Error details: Header: 3000006;reason="Token contains invalid signature.";category="invalid_client", Body: {"error_description":"Invalid JWT token. Could not resolve issuer token."}
0

I forgot to run some steps needed for an app to work in a dev environment. They are well explained here.

http://msdn.microsoft.com/en-us/library/fp179901.aspx

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.