-
Notifications
You must be signed in to change notification settings - Fork 4
Added support for Application Only OAuth flow and duration parameter #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
"Me" Endpoints:
Me() GET api/v1/me
MyKarama() GET api/v1/me/karma
MyPreferences() GET api/v1/me/prefs
MyTrophies() GET api/v1/me/trophies
MyFriends() GET api/v1/me/friends
User Endpoints:
AboutRedditor() GET user/<user>/about
UserTrophies() GET api/v1/user/<user>/trophies
Subreddit Endpoints:
AboutSubreddit() GET r/<subreddit>/about
Comments() GET comments/<subreddit>
Submit() POST api/submit
Delete() POST api/del
SubredditSubmissions() GET r/<subreddit>
FrontPage() GET
After a new OAuthSession type is created with NewOAuthSession(), the caller is given the choice of how the auth token should be created. The auth token is required to define the HTTP client used for API requests. Currently, LoginAuth() is the only method of token exchange. Other methods should be implemented in the future, which is why LoginAuth() does not happen by default within the constructor of OAuthSession.
Disabled by default. Accepts a time.Duration and each HTTP request must wait on interval to elapse. User can disable any existing throttling by passing 0.
When creating a new OAuthSession type, the caller can now choose between authenticating for personal use or on behalf of a user.
Personal script authentication (password credential exchange) is not issued a refresh token by Reddit's API. The caller must request a new access token after each one expires. The TokenExpiry field indicates the lifetime of a token and will help the user determine when a new access token must be created.
Add Reply
…tion parameter. For easier merging
|
Hi, thanks for the patch. I will take some time soon to go through the changes, and should probably have questions for you then. |
819f08e to
579cca6
Compare
|
@imheresamir I haven't completely forgotten about this change. 😅 Looks like it needs rebasing as there were changes upstream I've made. Let me know if you want to take a stab at that, or if I should just manually pick out the relevant bits. |
|
@imheresamir An additional thought: Maybe it's better to reopen this PR to the upstream repo now that my fork has been completely merged. Regardless I'll be looking at mixing this change into one of my personal projects, so we'll get it in one way or another. 😄 |
Application Only OAuth flow will auto refresh token before api requests, if necessary.
Please let me know what you think of the additions. I am keeping an eye on jzelinskie#12 as well.
Thanks for your contributions.
Samir