Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. {
  2. "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ1YnJpc2VjdXJpdHkiLCJzdWIiOjEsImlhdCI6MTU2MDc1NjM5MiwiZXhwIjoxNTYwNzU5OTkyfQ.YGLa9w2xwxVm07-T1O3F5XrWBjc2y_hCB_lT3G1QQAI",
  3. "idCliente": 1,
  4. "nombre": "Miguel Ángel"
  5.  
  6. {
  7. "error": "Email or password is wrong."
  8.  
  9. JSONObject map = new JSONObject();
  10. try {
  11. map.put("correo", Email);
  12. map.put("password", Password);
  13. } catch (JSONException e) {
  14. e.printStackTrace();
  15. }
  16.  
  17. JsonObjectRequest strRequest = new JsonObjectRequest(Request.Method.POST, url, map, new Response.Listener<JSONObject>() {
  18. @Override
  19. public void onResponse(JSONObject response) {
  20. System.out.println("Mensaje: " + response);
  21. JSONObject jsonChildNode;
  22. try {
  23. jsonChildNode = response.getJSONObject("0");
  24. String Token = jsonChildNode.getString("token");
  25. System.out.println("Mensaje: " + Token);
  26.  
  27. } catch (JSONException e) {
  28. e.printStackTrace();
  29. }
  30. }
  31. }, new Response.ErrorListener() {
  32. @Override
  33. public void onErrorResponse(VolleyError error) {
  34. System.out.println("Mensaje Error");
  35. //Log.e("JsonObjectRequestRespo", "::" + error.toString());
  36. }
  37. }
  38. );
  39. requestQueue.add(strRequest);
  40.  
  41. *2019-06-17 09:25:52.946 I/System.out: Mensaje: {"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ1YnJpc2VjdXJpdHkiLCJzdWIiOjEsImlhdCI6MTU2MDc1NjM1MSwiZXhwIjoxNTYwNzU5OTUxfQ.E4zlg5achP702TvSVPE6Pr2LKGe7aJn5ElToQpAcJdk","idCliente":1,"nombre":"Miguel Ángel"}
  42. *
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement