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

C# eBay.OAuth.Client returns invalid_client on GetApplicationToken

Hey all,

I am currently trying to get the Main Image of an eBay Listing - but currently I am struggling to even authenticate my application with eBay.

I am trying to get an application token using the CredentialUtil and OAuth2Api classes:

OAuth2Api oAuth = new();

IList<string> scopes = new List<string>()
{
    "https://api.ebay.com/oauth/api_scope"
};

CredentialUtil.Load("./ebay-config.yaml");

var creds = CredentialUtil.GetCredentials(OAuthEnvironment.SANDBOX);

var appToken = oAuth.GetApplicationToken(OAuthEnvironment.SANDBOX, scopes);

 The yaml file can be loaded just fine and the creds object holds my AppID, CertID and DevID.
the appToken object still returns an error "invalid_client" with the description "client authentication failed".

I really have no idea why that is, and since the C# SDK is poorly documented I have no idea if I am using the SDK correctly or if I am messing up anything in my eBay-App settings.

Any advice is appreciated. Thanks a lot in advance!

Message 1 of 5
latest reply
4 REPLIES 4

Re: C# eBay.OAuth.Client returns invalid_client on GetApplicationToken

Some additional information from more research:

Postman Request fails with the same error.

I can create an OAuth Token in the developer portal of the Ebay Developer Program.

Message 2 of 5
latest reply

Re: C# eBay.OAuth.Client returns invalid_client on GetApplicationToken

And another update:
Using the Access Token from the developer portal yields this error when using it:
"Invalid access token. Check the value of the Authorization HTTP request header."

I have found an old post, in which a user assumes, that the API Keys you get do not work right away. But I think this is to ridiculous to be true, because that is not even documented anywhere and also it would be so weird that the developer portal just returns an invalid Access Token. This would be the worst onboarding that I have ever seen in my life. Please prove me wrong. Or just tell me how it is. 😄

Message 3 of 5
latest reply

Re: C# eBay.OAuth.Client returns invalid_client on GetApplicationToken

Hi @stesomme48,

 

Error invalid_client generally indicates that the OAuth credentials were not provided correctly in the client credentials grant request

 

You can find the cURL code snipped for the request below: 

curl --location 'https://api.ebay.com/identity/v1/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic   Base64-encoded value of client_id:client_secret' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'scope=https://api.ebay.com/oauth/api_scope'


Also, the Application access token is valid for two hours from the time it was generated. For continued access after the token expires, you must mint a new token.

Best Regards,
eBay Developer Support
Message 4 of 5
latest reply

Re: C# eBay.OAuth.Client returns invalid_client on GetApplicationToken

I find it a bit insulting that after 2 days I come across an answer from the support team of them all that basically says: read the docs.

I've re read the docs a hundred times now, and it's still failing. I'm working on Postman as I first try it in here and then move on to my app. Didn't get passed the 'invalid_credentials' error.

All other posts about this issue say: wait and it will be resolved in a couple of days.

Is this the solution? waiting? If the solution is to wait, please explain why in the docs and let devs know about the waiting period.

This is a massive blocker.

Message 5 of 5
latest reply