Skip to content
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

Support refreshing oauth2 token #4

Open
Tomen opened this issue Aug 20, 2015 · 11 comments
Open

Support refreshing oauth2 token #4

Tomen opened this issue Aug 20, 2015 · 11 comments

Comments

@Tomen
Copy link

Tomen commented Aug 20, 2015

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

@stevenroose
Copy link
Owner

Thanks to point to the references, I will look at it tomorrow!
On Aug 20, 2015 11:13 PM, "Tommi Enenkel" notifications@github.com 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
#4.

@stevenroose
Copy link
Owner

I noticed that the Dart oauth2 package should do token refreshing automatically.
What kind of problem are you experiencing?

stevenroose added a commit that referenced this issue Aug 21, 2015
@stevenroose
Copy link
Owner

I added the duration=permanent parameter. Can you confirm if it works now? Then I'll push it to Pub..

@Tomen
Copy link
Author

Tomen commented Aug 25, 2015

Hey, awesome! I will look at it in the next few days and come back to you. Kind regards!

@Tomen
Copy link
Author

Tomen commented Aug 27, 2015

@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.

@stevenroose
Copy link
Owner

@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.

@stevenroose
Copy link
Owner

@Tomen Is this issue solved for you?

@Tomen
Copy link
Author

Tomen commented Dec 24, 2015

i will take a look at it in the new year. i will report to you here then.

Greetings :)

@mrdjohnson
Copy link

@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)?

@stevenroose
Copy link
Owner

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: #1, #2.

@mrdjohnson
Copy link

Hmm, I'll look deeper into those and see if anything becomes clear, thanks Steven

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants