Closed chrisdewa closed 3 years ago
I'm working on a PR to solve this issue.
I honestly wasn't aware tokens could last up to a week. From what I'd seen in the docs it was my understanding that the tokens should be discarded after use. This is also why I made the token a private attribute.
The ability to construct a session from a valid session is definitely something worth adding. Should probably add a property for accessing the token as well. I'll take a look at your PR tomorrow, I'm sure we can get something worked out.
Appreciate the help!
Fixed in most recent PR. 👌
When the
DiscordOAuthSession
instance fetches theaccess_token
on callback, the information contained in the token is this:(tokens removed for obvious reasons).
This information is lost in the examples supplied but can be preserved in this way:
The
expires_in
field gives the amount of seconds that the token should last before it expires, in this case its 604800 which amounts to one week.As follows, its unreasonable that the same token information cannot be used in following requests.
The DiscordOAuthSession instance must be able to be constructed from a valid token instead of only with the
code
Aditionally, it would also be useful if there was a
token_updater
method that would make use of the suppliedrefresh_token
.