vartanbeno / go-reddit

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

Support OAuth2 flow for "web app" #45

Open bevzzz opened 1 year ago

bevzzz commented 1 year ago

Related issue: https://github.com/vartanbeno/go-reddit/issues/44

Description

This MR introduces several changes to support "web app" clients:

Please note, that in order to complete the authorization with a web app, you will also need to host a service receiving code-redirects from Reddit (see docs on redirect_uri), but at the moment it seems beyond the scope of this PR or this package, for that matter. See unit tests for examples of how to use these options.

The changes to the packages API are minimal and are fully backwards-compatible:

Note: @vartanbeno I figured this repo is no longer being maintained and I changed the export path to github.com/bevzzz/go-reddit/v2 in the go.mod because I wanted to use the updated version of the package in my other project. If you decide to merge this PR, please let me know and I will revert that change.