title: How to obtain the authenticity token given the session and the devise secret key?
body: <p>How to obtain the authenticity token given the session and the secret key?</p>
  
  <p>I'm using rails and devise.
  I want to logout from a webview on a iOS app, but I get this error:</p>
  
  <pre><code>Can't verify CSRF token authenticity
  </code></pre>
  
  <p>So I'm planning to obtain the token from the session cookie and using the secret key. It might not be a good idea to ship the app with the secret key on the code, but I'm just planning to do it for a prototype. (How should I do it without using the secret key?)</p>
  
  <p><strong>Better solution</strong></p>
  
  <p>If you have access to the session via the cookies, you probably have access to the meta tags of the html, so you can easily retrieve the authenticity_token with this jquery:</p>
  
  <pre><code>$('meta[name=csrf-token]').attr('content')
  </code></pre>