Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ1YnJpc2VjdXJpdHkiLCJzdWIiOjEsImlhdCI6MTU2MDc1NjM5MiwiZXhwIjoxNTYwNzU5OTkyfQ.YGLa9w2xwxVm07-T1O3F5XrWBjc2y_hCB_lT3G1QQAI",
- "idCliente": 1,
- "nombre": "Miguel Ángel"
- {
- "error": "Email or password is wrong."
- JSONObject map = new JSONObject();
- try {
- map.put("correo", Email);
- map.put("password", Password);
- } catch (JSONException e) {
- e.printStackTrace();
- }
- JsonObjectRequest strRequest = new JsonObjectRequest(Request.Method.POST, url, map, new Response.Listener<JSONObject>() {
- @Override
- public void onResponse(JSONObject response) {
- System.out.println("Mensaje: " + response);
- JSONObject jsonChildNode;
- try {
- jsonChildNode = response.getJSONObject("0");
- String Token = jsonChildNode.getString("token");
- System.out.println("Mensaje: " + Token);
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
- }, new Response.ErrorListener() {
- @Override
- public void onErrorResponse(VolleyError error) {
- System.out.println("Mensaje Error");
- //Log.e("JsonObjectRequestRespo", "::" + error.toString());
- }
- }
- );
- requestQueue.add(strRequest);
- *2019-06-17 09:25:52.946 I/System.out: Mensaje: {"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ1YnJpc2VjdXJpdHkiLCJzdWIiOjEsImlhdCI6MTU2MDc1NjM1MSwiZXhwIjoxNTYwNzU5OTUxfQ.E4zlg5achP702TvSVPE6Pr2LKGe7aJn5ElToQpAcJdk","idCliente":1,"nombre":"Miguel Ángel"}
- *
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement