-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
I followed the instructions listed in the readme. I confirmed authorization URL is correct and matched what I see in the API Explorer. I am able to get a user token using the User Tokens section of eBay Developers website. However, the SDK is returning, "invalid_grant...the provided authorization grant code is invalid or was issue to another client". Here is the C# .NET 8 console application code. What am I doing wrong or it there a bug?
using eBay.ApiClient.Auth.OAuth2;
using eBay.ApiClient.Auth.OAuth2.Model;
CredentialUtil.Load("ebay-config.yaml");
OAuth2Api ebayApi = new OAuth2Api();
string userAuthorizationUrl = ebayApi.GenerateUserAuthorizationUrl(OAuthEnvironment.PRODUCTION, new List<string>()
{
"https://api.ebay.com/oauth/api_scope/sell.fulfillment.readonly"
}, null);
if (!string.IsNullOrEmpty(userAuthorizationUrl))
{
Console.WriteLine($"Authorization Url: {userAuthorizationUrl}");
OAuthResponse response = ebayApi.ExchangeCodeForAccessToken(OAuthEnvironment.PRODUCTION, userAuthorizationUrl);
if (response != null && response?.AccessToken == null)
{
Console.WriteLine($"Error Getting Token: {response?.ErrorMessage}");
}
else
{
Console.WriteLine($"Access Token: {response?.AccessToken}");
}
}
else
{
Console.WriteLine("Failed to get authorization URL");
}
gurolcetin
Metadata
Metadata
Assignees
Labels
No labels