question

kwon111 avatar image
0 Likes"
kwon111 asked ·

Problem with obtaining OAuth token

I have an authentication problem when trying to use [ebay-oauth-java-client][1] for eBay API. Here is my smoke test to get eBay time: OAuth2Api oauth2Api = new OAuth2Api(); OAuthResponse oauth2Response = oauth2Api.getApplicationToken(Environment.PRODUCTION, SCOPE_LIST_PRODUCTION); Optional<AccessToken> applicationToken = oauth2Response.getAccessToken(); oAuthToken = applicationToken.get().getToken(); ApiContext apiContext = new ApiContext(); ApiCredential cred = apiContext.getApiCredential(); cred.setOAuthToken(oAuthToken); apiContext.setApiServerUrl(" https://api.ebay.com/wsapi";); GeteBayOfficialTimeCall apiCall = new GeteBayOfficialTimeCall(apiContext); Date time = apiCall.geteBayOfficialTime().getTime(); It always fails with the error: > 04:16:59.972 [main] ERROR > com.ebay.sdk.ApiCall - > com.ebay.sdk.SdkSoapException: IAF token supplied is invalid. However when I go to [Application Keys][2], copy the key from UI and use it as a string literal in `cred.setOAuthToken()` method, it works perfectly. My `ebay-config.yaml` file looks good, just I am not sure about `redirecturi` value. I followed this doc https://developer.ebay.com/api-docs/static/oauth-redirect-uri.html and from the page https://developer.ebay.com/my/auth/?env=sandbox&index=0&auth_type=oauth I have just copied the value of **RuName (eBay Redirect URL name)** where it is stands along with Display Title and OAuth Enabled and used it as is. Could you please suggest, what am I missing? [1]: https://github.com/eBay/ebay-oauth-java-client [2]: https://developer.ebay.com/my/keys
oauth2authenticationtoken invalid
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
garlandhomecenter avatar image
1 Like"
garlandhomecenter answered ·
· Share
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.