[Beginner] Connect via OAuth2 on my Desktop App using C#

Hello there,

I went into develop recently a little program for a friend streamer on Twitch. It basically just parse a CSV file exctracted from the API, which gives a Subscribers list.

It work fine but, rather than getting a CSV manually, I would like to be able to connect my Application to the API.

I’m quite new in C# development world, but I wish to learn and as I made this simple parser and lottery program yesterday, I think I can handle a few weeks of learning to go through my goal :smile:

Here’s my question :
Is there any resource available on the net to help me build a WPF solution, which will be able to handle OAuth2 authorisation process without the use of an external webserver ? Maybe by including a webserver locally and requesting the token to be sent on the user computer ? Maybe using an existing library as I don’t want to reinvent the wheel…

If you have any link or suggestion to help me to accomplish this, I can handle the json parsing and other logics I’ll need.

Kind regards.

1 Like

What you can do is making a window with the WebBrowser controller (or CEF, but you need to install that).
Make it load the authorization page. When client is done with the authorization, client get sent back to a web page of yours where you can grab the token and send it directly to the application. You can make the page able to communicate with your application through javascript by creating an external object. (Keep in mind it’s not working on all platforms)

another way, which i did it, it create a simple http listener on a local port, which used the authorization code flow to get the code as part of the request url, and simply replied with a basic success web page which auto closed.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.