OAuth2 Refresh Token Grant

I have been trying to use the /oauth2/token endpoint in order to refresh my access tokens, but have been having a hard time figuring out what the expected form data is. I’ve been sending grant_type as "refresh_token" along with the other keys being refresh_token, client_id, and client_secret initialized to strings containing the corresponding values from my application and initial oauth authentication. However, I am receiving an invalid grant error.

Does anyone know what is expected in order to use the refresh tokens?

This worked for me in the past:

req = requests.post('https://online-go.com/oauth2/token/',
    data={'username': username,
        'refresh_token': token['refresh_token'],
        'client_id': client_id,
        'client_secret': client_secret,
        'grant_type': 'refresh_token'})
1 Like

Thank you so much! I had no idea that you needed to provide the username again