Open iwinulose opened 2 years ago
I think I fixed this bug, check this commit: https://github.com/not-an-aardvark/snoowrap/pull/338/commits/ebd3ab1c0d0a4b321657d0b0b90a61b56cbffe4e
- 🐛 Fixed a bug with
snoowrap#fromAuthCode
andsnoowrap#fromApplicationOnlyAuth
when they don't set the values ofrequester.tokenExpiration
andrequester.scope
after a successful authentication which causes the access token to refresh again for no reason '-' .
Update: Application Only OAuth is broken!
Any update on this? Setting permanent
to false
does not throw an error but it's not ideal.
@oakleyaidan21 permanent
is not supported anymore. What's the current behavior of snoowrap when setting permanent
to false
?
@iMrDJAi when I set permanent
to false
it behaves as @iwinulose described -- there is no API error and the snoowrap object can be used (albeit for only an hour). When I set it to true
or omit it I get this error: API Error: invalid_grant - undefined
. The snoowrap version I'm using is 1.23.0
.
@oakleyaidan21 Right! just wanted to be sure.
snoowrap#fromApplicationOnlyAuth
with permanent
set to false
only passes an access token
to the returned snoowrap instance, and snoowrap v1.23.0 can only refresh the access token
when a refresh token
is present (in this case there is none), and currently, there is no particular way to obtain a new application-only access token automatically.
However, I fixed that in the upcoming snoowrap v2.0. Work in progress...
The initial call to fromApplicationOnlyAuth succeeds, however the retrieved credentials appear to be invalid.
The initial access_token request seems to have changed to return both an access token and a refresh token, however the constructor does not expect to receive a refresh duration. The next attempt to call any API will trigger a refresh (as to the client it appears the access token is no longer valid.) The refresh fails w/ 400. Unfortunately, patching to fix this issue does not help, as any request made using the supposedly valid auth token is failed with 401.
As a workaround, clients created with the 'permanent: false' parameter work correctly.