Riley Pate Posted September 29, 2022 Share Posted September 29, 2022 (edited) I have a Windows desktop application that I am trying to integrate with Sage Accounting. I am at the first step of trying to get the authorization code. I was trying to find an example of how to implement this, but could not. It said all I had to do was to call the endpoint, and it would prompt the user to log in. I tried doing a basic HttpClient call, but there is no way for a user to log in using this. I tried just sending the user to the website with the correct query parameters in a WebView2 form, but after logging in it gives me the attached screen. There is no authorization code for the user to copy over. After doing this I should be able to make the calls to get the access token myself. The problem is just with the URL seemingly not working. Also, since my application is purely desktop based there is not actual URL to use as the callback URL. I just used my company's website as the URL as other integrations I have done have given the user the authorization code in plaintext to copy over to my program. Is this similar to how the Sage process will work, or will I need to listen somehow for when the user gets the code in a response? This doesn't seem like a simple API call like the documentation presents it. Edited September 29, 2022 by Riley Pate Changed to a question mark Link to comment Share on other sites More sharing options...
Administrators Ben Smith Posted October 3, 2022 Administrators Share Posted October 3, 2022 Hi Riley, I've replied to your email directly, but as we don't currently have one available, and for anyone else looking for an example of a desktop app connecting - the example Google provide here named 'OAuthDesktopApp' should help with the Oauth initiation from a form (WPF or WinForms should work here). The code example specifically can be found in the MainWindow.xaml.cs file. googlesamples/oauth-apps-for-windows: OAuth for Apps: Samples for Windows (github.com) Ben Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now