cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

request not working for refresh token

Hi,  I'm working to get the refresh token using OAuth. I have the code below, and it gives me the error: Error: 400, {"error":"invalid_grant","error_description":"the provided authorization grant code is invalid or was issued to another client"}. Any ideas??

 

import requests
import base64

client_id = sandbox_client_id
client_secret = sandbox_client_secret
redirect_uri = sandbox_redirect_uri
code = code
url = 'https://api.sandbox.ebay.com/identity/v1/oauth2/token'


auth = base64.b64encode(f'{client_id}:{client_secret}'.encode()).decode()


# Request headers
headers = {
    'Content-Type': 'application/x-www-form-urlencoded',
    'Authorization': f'Basic {auth}'
}

# Request body
data = {
    'grant_type': 'authorization_code',
    'code': code,
    'redirect_uri': redirect_uri
}

response = requests.post(url=url, headers=headers, data=data)

 
Message 1 of 1
latest reply
0 REPLIES 0