question

eil_esprit avatar image
0 Likes"
eil_esprit asked

oAuth Token Issue

Hi,


We have a C# app that we've been using without issues for several months to upload our stock and download our orders. Yesterday the app start having issues trying to get an access token. On my development machine the app works fine but on our app server the access token returned by eBay is often BUT not always null. When it does work we get a valid access token.

The code below is a cut down version of what we are using:

-- API Declarations
eBay.ApiClient.Auth.OAuth2.OAuth2Api apiAuth = new eBay.ApiClient.Auth.OAuth2.OAuth2Api();
eBay.ApiClient.Auth.OAuth2.Model.OAuthResponse resResponse;

-- Get the current access token details
clsSupport.OAuthUserToken oautCurrent = new clsSupport.OAuthUserToken("", null, "", null);
oautCurrent = clsSupport.OAuthUserTokenEIL;

-- List of access scopes.
IList<string> strIlScopes = new List<string>();
strIlScopes.Add("https://api.ebay.com/oauth/api_scope/sell.inventory.readonly");
strIlScopes.Add("https://api.ebay.com/oauth/api_scope/sell.inventory");
strIlScopes.Add("https://api.ebay.com/oauth/api_scope/sell.fulfillment.readonly");
strIlScopes.Add("https://api.ebay.com/oauth/api_scope/sell.fulfillment");


-- Call the eBay API.
resResponse = apiAuth.GetAccessToken(
       eBay.ApiClient.Auth.OAuth2.
       Model.OAuthEnvironment.PRODUCTION, 
       oautCurrent.RefreshToken, 
       strIlScopes
                                    );

-- Get the access token and expiry date and store it.
oautCurrent.AccessToken = resResponse.AccessToken.Token; // This is often null!
oautCurrent.AccessTokenExpiry = resResponse.AccessToken.ExpiresOn;

Any help with what might be going wrong would be great.

Thanks in advance.

Mike

oauth2
· 1
10 |600

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

if something only works randomly, it can be a DNS issue. you should also check the SSL connection (if your server is able to handle the SSL handshake) - and at the end, to check if the problem is not related to your code (maybe its a server issue) - try to make calls directly on the server via curl or whatever, but something different than your code.
0 Likes 0 ·

0 Answers

·

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.