Skip to content
Advertisement

Include authorization in a oauth2session for requests-oauthlib

From reading various documents it seems like authorization is optionally required by oauth2 providers for refresh token requests. I’m working with the FitBit API that appears to require authorization.

I’m following the instructions here for refreshing a token with requests-oauthlib: https://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#refreshing-tokens

Some setup code (not what I am using, but you get the idea:

JavaScript
JavaScript

However, with this call I’m getting:

JavaScript

I know my token is expired, but why isn’t the refresh working?

Advertisement

Answer

The library is broken in this regard. See #379.

You can work around it something like this:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement