Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8949163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:10:23+00:00 2026-06-15T13:10:23+00:00

I have a web application developed in .net framework. I am trying to implement

  • 0

I have a web application developed in .net framework. I am trying to implement Oauth in sugarCRM in order to integrate it with my applications.

The Oauth mechanism given by sugarCRM is using PHP Click Here…
where as, my application is designed in ASP.

I am trying to figure out solution (like converting php code to asp or implementing the same mechanism in my application) for same but got no solution.any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:10:24+00:00Added an answer on June 15, 2026 at 1:10 pm

    after much pain, I’ve got my .Net Code working on SugarCRM…..

    This is what I did….all in a Console app for me. This a proof of concept and so everthing is hard coded for now!

    Use Nuget to Install OAuth by Daniel Crenna

    Step 1: Establish Consumer Key

    Go into Admin -> OAuth Keys section on SugarCRM and create a new record, I used Key & Secret.

    Step 2: Creating a Request Token

    private static void CreateRequestToken()
    {
        // Creating a new instance directly
        OAuthRequest client = new OAuthRequest
        {
            Method = "GET",
            Type = OAuthRequestType.RequestToken,
            SignatureMethod = OAuthSignatureMethod.HmacSha1,
            ConsumerKey = "Key",
            ConsumerSecret = "Secret",
            RequestUrl = "http://localhost/service/v4/rest.php",
            Version = "1.0",
            SignatureTreatment = OAuthSignatureTreatment.Escaped
        };
    
        // Using URL query authorization
        string auth = client.GetAuthorizationQuery(new Dictionary<string, string>() { { "method", "oauth_request_token" } });
    
        var request = (HttpWebRequest)WebRequest.Create("http://localhost/service/v4/rest.php?method=oauth_request_token&" + auth);
        var response = (HttpWebResponse)request.GetResponse();
    
        NameValueCollection query;
        using (StreamReader sr = new StreamReader(response.GetResponseStream()))
        {
            string result = sr.ReadToEnd();
    
            query = HttpUtility.ParseQueryString(result);
        }
    
        Console.WriteLine(query["authorize_url"]);
        Console.WriteLine(query["oauth_token"]);
        Console.WriteLine(query["oauth_token_secret"]);
    }
    

    This is the tricky part that took me ages to figure out, notice the requesturl is without the query part in the client, and you have add it to the GetAuthorizationQuery call AND to the actual WebRequest url.

    Note down the 3 items ready for Step 4.

    Step 3 Approve Request Token

    Visit the url “authorize_url” above and also add &token= “oauth_token”. For this was:

    http://localhost/index.php?module=OAuthTokens&action=authorize&token=adae15a306b5
    

    Authorise the token and record the Token Authorisation Code.

    Step 4 Request Access Token

    private static void RequestAccessToken()
    {
        OAuthRequest client = new OAuthRequest
        {
            Method = "GET",
            Type = OAuthRequestType.AccessToken,
            SignatureMethod = OAuthSignatureMethod.HmacSha1,
            ConsumerKey = "Key",
            ConsumerSecret = "Secret",
            RequestUrl = "http://localhost/service/v4/rest.php",
            Version = "1.0",
            SignatureTreatment = OAuthSignatureTreatment.Escaped,
            Token = "adae15a306b5",
            TokenSecret = "e1f47d2a9e72",
            Verifier = "33e2e437b2b3"
        };
    
        // Using URL query authorization
       string auth = client.GetAuthorizationQuery(new Dictionary<string, string>() { { "method", "oauth_access_token" } });
    
       var request = (HttpWebRequest)WebRequest.Create("http://localhost/service/v4/rest.php?method=oauth_access_token&" + auth);
       var response = (HttpWebResponse)request.GetResponse();
    
       NameValueCollection query;
       using (StreamReader sr = new StreamReader(response.GetResponseStream()))
       {
           string result = sr.ReadToEnd();
           query = HttpUtility.ParseQueryString(result);
       }
    
       Console.WriteLine(query["oauth_token"]);
       Console.WriteLine(query["oauth_token_secret"]);
    }
    

    Token and TokenSecret are from Step 2, Verifier is the Auth Code from Step 3.

    Step 5 Use the Access Token

    I’m just using the session id as Recommended by the Documentation, so to get the sessionId

    private static void GetSessionId()
    {
        OAuthRequest client = new OAuthRequest
        {
            Method = "GET",
            Type = OAuthRequestType.ProtectedResource,
            SignatureMethod = OAuthSignatureMethod.HmacSha1,
            ConsumerKey = "Key",
            ConsumerSecret = "Secret",
            RequestUrl = "http://localhost/service/v4/rest.php",
            Version = "1.0",
            SignatureTreatment = OAuthSignatureTreatment.Escaped,
            Token = "adae15a306b5",
            TokenSecret = "2d68ecf5152f"
         };
    
         string auth = client.GetAuthorizationQuery(new Dictionary<string, string>() 
         { 
            { "method", "oauth_access" }, 
            { "input_type", "JSON" },
            { "request_type", "JSON" },
            { "response_type", "JSON" } 
         });
    
         var request = (HttpWebRequest)WebRequest.Create("http://localhost/service/v4/rest.php?method=oauth_access&input_type=JSON&request_type=JSON&response_type=JSON&" + auth);
         var response = (HttpWebResponse)request.GetResponse();
    
         dynamic o;
         using (StreamReader sr = new StreamReader(response.GetResponseStream()))
         {
             string result = sr.ReadToEnd();
             o = Newtonsoft.Json.JsonConvert.DeserializeObject(result);
         }
    
         Console.WriteLine("SessionId: {0}", o.id);
    }
    

    Here I’m using JSON.Net to parse the Json into a dynamic object for easy access to the id.

    Step 6 Make it do something….

    Over to you!

    Pretty painful experience, but at least its working for me…..

    Tim

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed an web application using Asp.net ( .Net Framework 3.0). In this
I have a Web Application (ASP.NET application developed with C# and .NET Framework 3.5)
I have developed one ASP.NET (C#) web application in Framework 4. I want to
I have a web application developed in ASP.NET 2.0, deployed in a data center.
I have a ASP.net 3.5 web application developed in VB.net I am using iTextsharp
i have developed a web application asp.net C#. on a button click i am
I have developed a MVC web application with ASP.NET MVC and im just wondering
My boss have given me assignment to find how a web based application developed
i have developed an web application[ERP FOR A SCHOOL].i have given the build for
We have a web application that runs on IIS using .NET 2.0 developed and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.