4

I have created a C# Windows Form Program that enables the user to drag and drop an image, pasting the url to that image into a text box. I now have to do the API side of this and authenticate with Imgur. Since I will be the only one using this program this should go easily but I cannot find much documentation on how one would authenticate with OAuth using C#. More specifically, I also cannot find any documentation on how to upload images with C# to Imgur. If anything, I would like to have it upload the image into a certain album as well, if that is even a possibility.

Could anyone help at all?

user4191887
  • 277
  • 3
  • 15
  • Look at this, may help you? http://stackoverflow.com/questions/2073519/uploading-to-imgur-com – Trevor Hart Feb 15 '16 at 00:10
  • No, that's for posting anonymous images and I'm looking to authenticate and post on an account – user4191887 Feb 15 '16 at 00:13
  • Gotcha, Well....I'm afraid I'm not much help on topic, typically each site or whatever has it's own way of authenticating, like Facebook you have to register an app and get a secret key or something like that, similar process for Google, etc. so unless Imgur has something like that there isn't really any way to do this since you'd have to touch their database. – Trevor Hart Feb 15 '16 at 00:16
  • I do have my secret key but you need to get authenticated through the browser to access a specified person's account – user4191887 Feb 15 '16 at 00:18
  • http://stackoverflow.com/a/24270278/1070452 – Ňɏssa Pøngjǣrdenlarp Feb 15 '16 at 01:04
  • That is VB.net, I'm looking to use C# – user4191887 Feb 15 '16 at 15:49

1 Answers1

1

OAuth2 is authorization standard, you can find rfc specification here. Lot of web applications implements this which means that if you have oauth2 client you can "log in" to any of those applications. Basically what you need to do is read this Imgur document, which explains how you need implement your oauth2 client to log into their app.

In C# its just bunch of HTTP requests, so you can implement it with use of classes like HttpClient or you can look for already implemented c# oauth2 client nuget. Than you just pass some urls to that client and your done with authorization.

For the upload part you have to read documentation for upload api and again implement the client of that api.

Community
  • 1
  • 1
mano
  • 136
  • 3