requests / requests-oauthlib

OAuthlib support for Python-Requests!
https://requests-oauthlib.readthedocs.org/
ISC License
1.72k stars 424 forks source link

Doesn't allow custom grant types #424

Open fparra-adv opened 4 years ago

fparra-adv commented 4 years ago

I am trying to use the refresh_token method to get an access token and getting this error.

The API I am using requires that I use the value "refresh_token" for grant type when requesting an access token. When creating an object it always starts with a grant type of 'authorization_code'.

prepare_token_request() got multiple values for argument 'grant_type'

kwargs = { 'grant_type': 'refresh_token', 'preserve_refresh_token': True, 'client_id': client_id, 'client_secret' : client_secret }

auth =OAuth2Session()

access_token  = auth.refresh_token(token_url=token_url, refresh_token= refresh_token,  **kwargs)