Android POST Data to server

142 views Asked by At

please help me! I send this post to sever for authorization via email, but server answered

"error":"Wrong input parameters"

I know to items is true !and proplem is not in items!

public String RegistrationByEmail(String email, String username, String password) throws IOException {
    if (android.os.Build.VERSION.SDK_INT > 9) {
        StrictMode.ThreadPolicy policy
                = new StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);
    }
    HttpClient httpclient = new DefaultHttpClient();
    HttpPost httppost = new HttpPost("http://speechyard.com/api/register");

    try {
        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(3);

        nameValuePairs.add(new BasicNameValuePair("email", email));
        nameValuePairs.add(new BasicNameValuePair("username", username));
        nameValuePairs.add(new BasicNameValuePair("pssword", password));

        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

        HttpResponse response = httpclient.execute(httppost);
        Id_Token_from_website2 = responseHandler(response);
        Log.v(TAG, "Id_Token_from_website :   " + Id_Token_from_website2);

    } catch (ClientProtocolException e) {
    } catch (IOException e) {
    }
    return Id_Token_from_website2;
}
1

There are 1 answers

1
GameDroids On

you may have a typo here:

nameValuePairs.add(new BasicNameValuePair("pssword", password));

I think it should be:

nameValuePairs.add(new BasicNameValuePair("password", password));

you forgot the a in password