ChainStoreWeb.TokenHelper.GetClientContextWithContextToken C# (CSharp) Method

GetClientContextWithContextToken() public static method

Retrieves an access token from ACS using the specified context token, and uses that access token to create a client context
public static GetClientContextWithContextToken ( string targetUrl, string contextTokenString, string appHostUrl ) : ClientContext
targetUrl string Url of the target SharePoint site
contextTokenString string Context token received from the target SharePoint site
appHostUrl string Url authority of the hosted app. If this is null, the value in the HostedAppHostName /// of web.config will be used instead
return ClientContext
        public static ClientContext GetClientContextWithContextToken(
            string targetUrl,
            string contextTokenString,
            string appHostUrl)
        {
            SharePointContextToken contextToken = ReadAndValidateContextToken(contextTokenString, appHostUrl);

            Uri targetUri = new Uri(targetUrl);

            string accessToken = GetAccessToken(contextToken, targetUri.Authority).AccessToken;

            return GetClientContextWithAccessToken(targetUrl, accessToken);
        }