dart-reddit
dart-reddit copied to clipboard
Support refreshing oauth2 token
https://github.com/reddit/reddit/wiki/OAuth2#refreshing-the-token states that the token hast to be refreshed every hour by adding duration=permanent to the authorization request. I suppose this just has to be added here: https://github.com/stevenroose/dart-reddit/blob/master/lib/src/reddit.dart#L135-L138
Thanks to point to the references, I will look at it tomorrow! On Aug 20, 2015 11:13 PM, "Tommi Enenkel" [email protected] wrote:
https://github.com/reddit/reddit/wiki/OAuth2#refreshing-the-token states that the token hast to be refreshed every hour by adding duration=permanent to the authorization request. I suppose this just has to be added here: https://github.com/stevenroose/dart-reddit/blob/master/lib/src/reddit.dart#L135-L138
— Reply to this email directly or view it on GitHub https://github.com/stevenroose/dart-reddit/issues/4.
I noticed that the Dart oauth2 package should do token refreshing automatically. What kind of problem are you experiencing?
I added the duration=permanent parameter. Can you confirm if it works now? Then I'll push it to Pub..
Hey, awesome! I will look at it in the next few days and come back to you. Kind regards!
@stevenroose Hey, i just checked it over night and i made a mistake. There is a chapter on application only oauth2 here: https://github.com/reddit/reddit/wiki/OAuth2#application-only-oauth
It states that applications never get a refresh token. It does not state why. So it looks to me as if you always had to get a fresh token (either once an hour or before every request).
So it seems as this is not fixable.
@Tomen The library keeps the credentials anyways, so it can keep the expiration date and manually reauthenticate when a request is made after the token expires.
Should work, that is kindof how the oauth2 package does it, only they use the official refresh token mechanism.
Will try to look at this tomorrow or perhaps this evening.
@Tomen Is this issue solved for you?
i will take a look at it in the new year. i will report to you here then.
Greetings :)
@Tomen & @stevenroose I was actually having an issue where I could not make authenticated calls at all. I realized that no authenticated calls (like get my subreddits) were in the examples. I tried to implement my own but I ran into a bunch of 403 errors everytime.
Do either of you have examples on calls that NEED oauth (instead of calls that work generically, like get posts)?
I haven't used any, personally. So it's very well possible they are not supported, in which case contributions are more than welcome!
Perhaps you can check out some old issues, I remember people asking questions about oauth: https://github.com/stevenroose/dart-reddit/issues/1, https://github.com/stevenroose/dart-reddit/issues/2.
Hmm, I'll look deeper into those and see if anything becomes clear, thanks Steven