javaoauth-2.0ebay-apiebay-sdk

eBay OAuth Authorize Grant Flow Invalid Parameters


I'm using the ebay-oauth-java-client to get an authorization url, however, this seems to not be working and complaining Error message:

{"error_id":"invalid_request","error_description":"Input request parameters are invalid.","http_status_code":400}

auth url with client secret added to end:

https://auth.sandbox.ebay.com/oauth2/authorize?client_id=blabla-blabla-blabla-blabla-blabla&response_type=code&redirect_uri=http://localhost:8080/callback&scope=https://api.ebay.com/oauth/api_scope/buy.order.readonly&state=randomString&client_secret=blabla-blablabla

Code:

        OAuth2Api oauth2Api = new OAuth2Api();
        String state = "randomString"; // Optional state parameter for CSRF protection
        String authorizationUrl = oauth2Api.generateUserAuthorizationUrl(Environment.SANDBOX, SCOPES, Optional.of(state));
        return Mono.just(ResponseEntity.status(HttpStatus.FOUND)
                .headers(httpHeaders -> httpHeaders.add(HttpHeaders.LOCATION, authorizationUrl))
                .build());

Any ideas as to what i could be doing wrong?


Solution

  • Figured it out. Redirect uri isn't really a uri, it expects a ebay RuName id: in the case below mine is Jaime_Moncayo-blabalablabla

    enter image description here

    therefore the authlink would be https://auth.sandbox.ebay.com/oauth2/authorize?client_id=blabla-blabla-blabla-blabla-blabla&response_type=code&redirect_uri=jaime_moncayo-balbla&scope=https://api.ebay.com/oauth/api_scope/buy.order.readonly&state=randomString&client_secret=blabla-blablabla