-1

I need to access this url and put user name and password I am trying a HTTP Post request with parameter but it's giving an error.Can any one help me how can I access this url from android.

https://54.204.193.209:943/rest/GetUserlogin

Getting ERROR

javax.net.ssl.SSLPeerUnverifiedException: No peer certificate
ngrashia
  • 9,869
  • 5
  • 43
  • 58
A J
  • 4,542
  • 5
  • 50
  • 80

1 Answers1

2

When I tried to access your url, pop up comes up asking to enter credentials that means at server side, HTTP Basic Authentication has been enabled. To access anything on server, you have to go through it. Add following code :

// Set credentials for HTTP Basic Authentication
defaultHttpClient.getCredentialsProvider().setCredentials(
        new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT),
        new UsernamePasswordCredentials(
                HTTPS_BASIC_AUTH_USERNAME,
                HTTPS_BASIC_AUTH_PASWORD));

Credentials for HTTP basic auth is unique for one server, hence you can hardcode it in your java code. Hope, this will help you.

Harry
  • 422
  • 3
  • 11