Re: Two-way ssl fails in android

Regular Visitor

Two-way ssl fails in android

I tested every thing in SoapUI and "Helloworld" is ok, I want ti implement it in android but I couldn't so far. How can I use two way ssl in android? Do you have very basic sample code just for Httpconnection? your sample java codes are not readable at least for me!


 public void postData(Context context) {

        String url = "";
        String obj = "";
        JSONObject object = new JSONObject();
        try {
            object = new JSONObject(obj);
        } catch (JSONException err) {
            Log.e("Error", err.toString());
        // Enter the correct url for your api service site
        JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, url, object,
                new Response.Listener<JSONObject>() {
                    public void onResponse(JSONObject response) {
                        Log.e("Response", response.toString());
                }, new Response.ErrorListener() {
            public void onErrorResponse(VolleyError error) {
                Log.e("errrororor", error.toString());

        }) {
            public Map<String, String> getHeaders() throws AuthFailureError {
                final Map<String, String> headers = new HashMap<>();
                headers.put("Authorization", "{"+Base64.getEncoder().encodeToString((user + ":" + pass).getBytes())+"}");//put your token here
                return headers;
        RequestQueue requestQueue = Volley.newRequestQueue(context);

this is code I used to connect to sanbox, I need to add my key to this code I could't because the sapmle code provided in: 

doesn't work anymore because of change in new versions of android after 23. 

Visa Developer Support Specialist

Re: Two-way ssl fails in android

Hey @ehsan,


Can you please let us know the API product name that your question is related to?




Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.