Closed bogatuadrian closed 5 years ago
I looked at your changes and I would accept a PR if you'd like to share them upstream. The only thing I'd like to add is an error if username or password are set, but not the other. Thank you for opening an issue!
@turnage Is it OK to return the error from the authorize()
method? I would have liked it to be further up the stack, but I can't find a good place for it (mostly because configured()
returns a boolean and I don't want to change too many things).
@turnage It could be cleaner and better for testing to refactor configured() bool
to validate() error
and return appropriate validation errors. What do you say?
Yeah iirc that doesn't change the public API so sounds totally fine.
Yeah, it is un-exported and called only in one place (except for a test).
PR https://github.com/turnage/graw/pull/46 aims at providing the discussed feature.
Merged! Thank you for upstreaming your changes!
graw doesn't seem to support Application Only OAuth (as described in the reddit OAuth doc) for "read-only" "user-less" access to the reddit API.
This should be made possible by allowing empty username and password in the
reddit.App
struct and using golang.org/x/oauth2/clientcredentials for 2-legged OAuth authentication inappClient
's authorize method if theUsername
and/orPassword
fields are not provided.I can make a pull request if you agree this feature should be added. I will probably fork graw anyway because I need this feature for a project.
Thanks