public string RefreshAccessToken(FormCollection form)
        {
            string spWebUrl = form["spWebUrl"];
            string tenantId = form["tenantId"];

            string refreshTokenContent = _refreshTokenManager.RetrieveToken(HttpContext.Request);

            var credential  = new ClientCredential(SettingsHelper.ClientId, SettingsHelper.ClientKey);
            var authContext = new AuthenticationContext(SettingsHelper.AUTHORITY + tenantId);

            try
            {
                AuthenticationResult result = authContext.AcquireTokenByRefreshToken(refreshTokenContent, credential, spWebUrl);

                if (result == null)
                {
                    throw new Exception("Error acquiring SharePoint AccessToken.");
                }

                return(result.AccessToken);
            }
            catch (AdalServiceException exception)
            {
                throw new Exception("SharePoint RefreshToken is invalid.", exception);
            }
        }