title: Access with csrf token using Volley Android
body: <p>I'd like to send a request and get the XSRF-TOKEN from it's cookie and when I send the POST to the register I'd like to put it into the header. Actually I'd like to do something this: <a href="https://stackoverflow.com/questions/31627477/access-laravel-app-from-android-app-with-csrf-token">access laravel app from android app with csrf token</a></p>
  
  <p>I'm using StringRequest to send a request like this: </p>
  
  <pre><code>private void registerUser(final String name, final String email,
                            final String password,final String confirm) {
      // Tag used to cancel the request
      String tag_string_req = "req_register";
  
      pDialog.setMessage("Registering ...");
      showDialog();
  
      final StringRequest strReq = new StringRequest(Request.Method.POST,
              AppConfig.URL_REGISTER, new Response.Listener&lt;String&gt;() {
  
          @Override
          public void onResponse(String response) {
  
              datares = response;
  
              Log.d("REGISTER RESPONSE", "Register Response: " + response.toString());
  
      }, new Response.ErrorListener() {
  
          @Override
          public void onErrorResponse(VolleyError error) {
              Log.e(TAG, "Registration Error: " + error.getMessage());
              Toast.makeText(getActivity().getApplicationContext(),
                      error.getMessage(), Toast.LENGTH_LONG).show();
              hideDialog();
          }
      }) {
  
          @Override
          protected Map&lt;String, String&gt; getParams() {
              // Posting params to register url
              Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
              params.put("name", name);
              params.put("email", email);
              params.put("password", password);
              params.put("password-confirm",confirm);
  
              return params;
          }
  
      };
      // Adding request to request queue
      AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
  }
  </code></pre>
  
  <p>And the AppController.java</p>
  
  <pre><code>public static synchronized AppController getInstance() {
      return mInstance;
  }
  
  public RequestQueue getRequestQueue() {
      if (mRequestQueue == null) {
          mRequestQueue = Volley.newRequestQueue(getApplicationContext());
      }
  
      return mRequestQueue;
  }
  
  public &lt;T&gt; void addToRequestQueue(Request&lt;T&gt; req, String tag) {
      req.setTag(TextUtils.isEmpty(tag) ? TAG : tag);
      getRequestQueue().add(req);
  }
  </code></pre>
  
  <p>Have you any idea how can I do this with Volley?</p>