question

triggerh4ppy avatar image
0 Likes"
triggerh4ppy asked

Invalid client from OAuth generate token API

I get the following error when trying to generate the oauth token via the code below. Code below works for others (taken from stackoverflow where users said it worked).


However I get the error:

{'error': 'invalid_client', 'error_description': 'client authentication failed'}


Code below is concatenating client_id : client_secret (base64 encoded)

The client_id/secret match the keys I can see in my ebay developers portal.


Any ideas?



import requests, urllib, base64


def getAuthToken():

AppSettings = {

'client_id':'<client_id_removed>',

'client_secret':'<client_secret_removed>',

# 'ruName':'http://ebay.com'

}


authHeaderData = AppSettings['client_id'] + ':' + AppSettings['client_secret']

encodedAuthHeader = base64.b64encode(str.encode(authHeaderData))


headers = {

"Content-Type" : "application/x-www-form-urlencoded",

"Authorization" : "Basic " + str(encodedAuthHeader)

}


body= {

"grant_type" : "client_credentials",

# "redirect_uri" : AppSettings['ruName'],

"scope" : "https://api.ebay.com/oauth/api_scope"

}


data = urllib.parse.urlencode(body)


tokenURL = "https://api.ebay.com/identity/v1/oauth2/token"


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

return response.json()



response = getAuthToken()

print(response)

authentication failed
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
ansl9377 avatar image
0 Likes"
ansl9377 answered

We are getting the same error but no solution yet, feel free to also follow this thread: https://forums.developer.ebay.com/questions/30751/quotgrant-type-in-request-is-not-supported-by-the.html

Please reply if you solve it as it's preventing us from progressing also.

10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.