Hi,
Here's a sample code that we are using for a provider hosted app. Somehow the contextToken is coming as null and hence not able to pull information from SP list. Please suggest.
try
{
SharePointContextToken contextToken;
Uri sharepointUrl;
string accessToken;
TokenHelper.TrustAllCertificates();
string contextTokenString = TokenHelper.GetContextTokenFromRequest(Request);
if (contextTokenString != null)
{
contextToken = TokenHelper.ReadAndValidateContextToken(contextTokenString, Request.Url.Authority);
sharepointUrl = new Uri(Request.QueryString["SPHostUrl"]);
accessToken = TokenHelper.GetAccessToken(contextToken, sharepointUrl.Authority).AccessToken;
ClientContext context = TokenHelper.GetClientContextWithAccessToken(sharepointUrl.ToString(), accessToken);
SharePoint Architect