title: How to post csrf token from android to spring?
body: <p>I have Web API for Spring in Java . Now, I went to need GET and POST some Data in my android Apps. The Problem is CSRF token.First a I get csrf token in android apps. Then I post the csrf token form android apps in Web server. when I disable the csrf Security then I Post data web server from android.But when I enable the csrf Security then Post method is not working.</p>
  
  <p>Now, how can I post a csrf token in web server from Android?</p>
  
  <p>THANKS in advance ..</p>
  
  <p>** ..The Post Method ..**
  ..................................</p>
  
  <pre><code>    public void sendPostCsrf(String mEmail, String mPassword, String mCsrf, String mCsrfHeader) {
      csrfApi.savePost(mEmail, mPassword, 1, mCsrf, mCsrfHeader)
              .enqueue(new Callback&lt;PostModel&gt;() {
                  @Override
                  public void onResponse(Call&lt;PostModel&gt; call, Response&lt;PostModel&gt; response) {
                      if (response.isSuccessful()) {
                          //  showResponse(response.body().toString());
                          Toast.makeText(LoginActivity.this, "Success ", Toast.LENGTH_SHORT).show();
                          Log.d(TAG, "Retrofit " + new Gson().toJson(response.body()));
                      }
                  }
                  @Override
                  public void onFailure(Call&lt;PostModel&gt; call, Throwable t) {
                      Log.e(TAG, "Retrofit " + t.getMessage());
                  }
              });
  
  } 
  </code></pre>
  
  <p>...................................</p>
  
  <p>The interface Post last URL code.
  ...................................</p>
  
  <pre><code> @POST("/testingjsonpost")
  @FormUrlEncoded
  Call&lt;PostModel&gt; savePostCsrf(@Field("email") String mEmail,
                           @Field("password") String mPassord,
                           @Field("userId") long userId,
                           @Field("_csrf")String csrf,
                           @Field("_csrf_header") String csrfHeader);
  </code></pre>
  
  <p>...................................</p>