vartanbeno / go-reddit

Go library for accessing the Reddit API.
Other
306 stars 84 forks source link

[Feature request]: Authorization flow for "web app" #44

Open bevzzz opened 1 year ago

bevzzz commented 1 year ago

Reddit API allows authorization for 3 app types:

At the moment it seems that go-reddit only supports the latter use case -- oauthTransport uses Username + Password to obtain and renew access tokens.

In order to send requests to Reddit's API on behalf of multiple users, we need to support OAuth2 for "web apps". (see also the API docs). Should be a rather simple change, as the standard oauth2 library also supports exchanging code for token.

I am using go-reddit in one of my private projects and need this functionality, so I'll be happy to contribute a PR :)