Quantcast
Channel: Developing Apps for SharePoint 2013 forum
Viewing all articles
Browse latest Browse all 8089

SharePoint 2013 Provider Hosted App - "The parametere "token" cannot be null or empty"

$
0
0

Hi,

I have a SharePoint 2013 Provider Hosted App with MVC Web application. I have added TokenHelper.cs to for CSOM.

But I am not getting client context, my code is as below:

var contextToken = TokenHelper.GetContextTokenFromRequest(Request);
            var hostWeb = Request["SPHostUrl"];

            using (var clientContext = TokenHelper.GetClientContextWithContextToken(hostWeb, contextToken, Request.Url.Authority))
            {
                clientContext.Load(clientContext.Web, web => web.Title);
                clientContext.ExecuteQuery();
                ViewBag.Message = clientContext.Web.Title;
            }

And I am getting error at following line in TokenHelper.c

SecurityToken securityToken = tokenHandler.ReadToken(contextTokenString);

This is because clientcontext is null.

Can anyone help me with it.

Thanks.


Viewing all articles
Browse latest Browse all 8089

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>