I want to set up a successful request for Neteller, I am trying to get the token using the code from the Neteller documentation I
However, it fails consistently with the following exceptions:
java.io.IOException: The server returned the HTTP response code: 401 for the URL: https: // Test.api.neteller.com/v1/Oauth2/token? Grant_type = client_credentials
Here is the code (again, from the netler document):
string testUrl = "https: // test .api.neteller.com "; String protected url = "https://api.neteller.com"; String url = testUrl; If ("live" .equals (configBean.get ("environment"))) {url = secureUrl; } Url + = "/ v1 / oauth2 / token? Grant_type = client_credentials"; String xml = "grant_type = client_credentials? Grant_type = client_credentials"; Xml = ""; String Test = Base64.exodabytes ((AccountID + ":" + + Secure ID) .getBytes ()); {URL should try urls = new URL ("https://test.api.neteller.com/v1/oauth2/token?grant_type=client_credentials"); HttpURL Connection Connection = (HttpURLConnection) urls.openConnection (); Connection.setRequestMethod ("post"); Connection.setDoOutput (true); Connection.setRequestProperty ("Authority", "Bearer" + Exam); Connection.setRequestProperty ("content-type", "app / json"); Connection.setRequestProperty ("cache-control", "no-cache"); DataOutputStream wr = New DataOutputStream (connection.getOutputStream ()); Wr.flush (); Wr.close (); BufferedReader = new in BufferedReader (new InputStreamReader (connection.getInputStream ())); String inputline; String buffer response = new stringbuffer (); While ((inputLine = in.readline ()) = null) {response.append (inputLine); } In.close (); String AccessToken = ""; } Hold (exception e) {e.printStackTrace (); }
Why is my implementation unsuccessful here? There is nothing wrong in your code. The problem is that you have a for API integration.
No comments:
Post a Comment