• sajm_2010
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 3
    Replies

I am trying  for the Oauth  Code.It is Working fine with linkedin oauth api but  when i try with the salesforce it throws an error 'Signature invalid'. I tried with the get and post methods but not able to resolve this methods.can anyone any idea about  how to get the request token.

 

 

string stroauth_signature_method = "HMAC-SHA1";

            string stroauth_version = "1.0";

            string outUrl = "";

            string querystring = "";

            string consumerKey = "3MVG9Y6d_Btp4xp5HE.zoyjqpLRQO7n9twJD9LCyT6DAfnpxkv5EmtHIaxkM5duimUltRtubV8Aa4OexNatwT";

            string consumerSecret = "1964943390161656075";

            //Uri uri = new Uri(@"https://api.linkedin.com/uas/oauth/requestToken");

            Uri uri = new Uri(@"https://login.salesforce.com/_nc_external/system/security/oauth/RequestTokenHandler");

            Uri uri1 = new Uri(@"https://login.salesforce.com");

 

            OAuthBase oAuth = new OAuthBase();

            string nonce = oAuth.GenerateNonce();

            string timeStamp = oAuth.GenerateTimeStamp();

            string sig = oAuth.GenerateSignature(uri, consumerKey, consumerSecret, string.Empty, string.Empty, "POST", timeStamp, nonce,OAuth.OAuthBase.SignatureTypes.HMACSHA1, out outUrl, out querystring);

            sig = HttpUtility.UrlEncode(sig);

            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("oauth_consumer_key={0}", consumerKey);

            sb.AppendFormat("&oauth_nonce={0}", nonce);

            sb.AppendFormat("&oauth_signature_method={0}", stroauth_signature_method);

            sb.AppendFormat("&oauth_signature={0}", sig);

            sb.AppendFormat("&oauth_timestamp={0}", timeStamp);          

            sb.AppendFormat("&oauth_version={0}", stroauth_version);           

            sb.AppendFormat("&oauth_callback={0}", "oob");

            //uri = new Uri(sb.ToString());

            //sb.AppendFormat("&oauth_token={0}", "11111111");

            HttpWebRequest request = System.Net.WebRequest.Create(uri.ToString()) as HttpWebRequest;

            //HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri.ToString());

            request.Method = "POST";

            request.ContentType = "application/x-www-form-urlencoded";

            //request.Headers.Add("oauth_consumer_key", consumerKey);

            //request.Headers.Add("oauth_nonce", nonce);

            //request.Headers.Add("oauth_timestamp", timeStamp);

            //request.Headers.Add("oauth_signature_method", stroauth_signature_method);

            //request.Headers.Add("oauth_version", stroauth_version);

            //request.Headers.Add("oauth_signature", sig);

            //request.Headers.Add("oauth_callback", "oob");

            request.Headers.Add("Authorization", "OAuth oauth_consumer_key=\"" + consumerKey + "\",oauth_signature_method=\"HMAC-SHA1\",oauth_signature=\"" + sig + "\",oauth_timestamp=\"" + "1191242096" + "\",oauth_nonce=\"" + nonce + "\", oauth_version=\"1.0\",oauth_callback=\"oob\"");

            //request.Credentials = CredentialCache.DefaultCredentials;

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            //using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)

            //{

            //    using (TextReader reader = new StreamReader(response.GetResponseStream()))

            //    {

            //        ///oauthtokendata = HttpUtility.ParseQueryString(reader.ReadToEnd());

            //    }

            //}

Hi All,

 

Please help me in knowing how to import attachments in salesforce? I tried, but it gives me in some encrypted form. Is there a way in Salesforce to import these?

 

Thanks

Hi, Can anybody help me in telling,  how to implement inline editing if records are coming in repeater on VF page. I want the functionality of the inline editing the same way, salesforce do.

 

Please help.

 

Thanks, in advance

hi,

 

i have a visualforce page with two picklist values month and year. How can i make the values in the picklist default to current month and current year when the page loads,

Does anyone know how I can delete an attachment on a VF page by just using a link? I allow my users to upload images to be displayed and I want them to be able to just click a link or small button that allows them to delete the image.

 

I know I can use the <apex:listViews type="attachment"/> and see all the attachments and get the Edit | Del | View but I just want the delete button. While working with my DE account I was able to use this:

 

 

<apex:repeat value="{!Member__c.attachments}" var="attachment" rows="1" first="0"> 
    
<a href="/setup/own/deleteredirect.jsp?delID={!attachment.ID}" onclick="confirmation4()">Delete</a>

<img src="{!URLFOR($Action.Attachment.Download, attachment.Id)}"/>
</apex:repeat>

 

 

and I was able to delete with no issues. But with keeping this same code in my Enterprise Production Trial it doesn't seem to work. I highlighted the delete link in the listview to get the URL and created this link:

 

<a href="/setup/own/deleteredirect.jsp?id={!Member__c.id}&delID={!attachment.ID}">Del.</a>

 

but I keep getting an error message saying "The attempted delete was invalid for your session. Please confirm your delete." and then there's a delete link right below but I click on it and nothing happens.

 

Any ideas? I'm stuck.... Thanks!

  • August 09, 2010
  • Like
  • 0