Authentication via C# Winforms application

Hi,

I'm currently attempting to authenticate via a C# Winforms application and am struggling to figure out how to do so. I am following the document here:

developer.sage.com/.../

Is there a sample somewhere demonstrating how to do this from a desktop application?

Parents
  • Hi Brandon,

    the documentation about authentication that you've linked is currently the only detailed document about it. As we are constantly improving the documentation, there might be updates in the future. 

    To authenticate a Windows application, you need to have a web view to open the Auth Page of Sage Accounting (see Authentication Request in the documentation). You need to take all query params from the redirect URL call to get your first token (explained in Exchange the authorization code for the access token).

    I hope that this might help you somehow. 

  • Hi, I tried to get "Code", as mentioned in this document, but not success. Please help me.

    using (var wb = new WebClient())
    {
    var data = new NameValueCollection();
    data["username"] = userName;
    data["password"] = password;
    wb.UseDefaultCredentials = true;
    var response13 = wb.UploadValues(URL, "POST", data);
    string responseInString = Encoding.UTF8.GetString(response13);
    }

  • Hi Brandon, hi Ayush!

    I do not know about your problem in detail, but I have an Idea how I can help you.

    In our Sage Github organisation we have API sample applications in some common languages.

    Please have a look at in this repository -> https://github.com/Sage/sageone_api_csharp_sample

    It uses .NET core, ASP.NET core, docker and the offlicial Microsoft oAuth2 library. If you want to use the API with old .NET world, this code is very similar I think.

    You should have a deeper look in https://github.com/Sage/sageone_api_csharp_sample/blob/master/app/Startup.cs . Here you find the oAuth2 (object) registration and the authentication processes.

    If you have more questions, just ask.

    I hope this was useful.

    Robert

Reply Children
No Data