Tejus's Programming and startup blog

  • Archive
  • RSS
  • Ask me anything

Access Denied Error when using XHR PUT and DELETE

Late one night, I was attempting to wire up a delete button on a Rails app using XHR. However, every time I attempted to make the XHR call, I saw AccessDenied in the server log and my session was un authenticated. Since it was late, I remapped it to a different URL and moved on.

However, the fact that this did not work still bothered me and when I revisited it after a good night’s sleep, the answer was quite obvious. My Ajax setup (copied from many Rails projects ago) looked like:

http://gist.github.com/1769263

I was only setting the X-CSRF-Token on a POST. Therefore, when the server received the DELETE verb, it killed the session, thinking that something was afoul.

Changing that line to:

http://gist.github.com/1769443

fixed the issue in the correct way.

    • #ruby
    • #ruby on rails
    • #security
  • 3 months ago
  • Comments
  • Permalink
  • Share
    Tweet

Import your wordpress blog into Tumblr

Last week, I searched rather fruitlessly for a way to import my wordpress blog into Tumblr. There were a few snippets and examples out on the web, but they all used the older API or required email addresses and passwords for authentication.

Since I couldn’t find what I was looking for, I opened up my IDE, fought with OAuth, and created a Wordpress to Tumblr importer.

Using the importer is pretty easy, you just need ruby and bundlr. The script is a sinatra application so you should will only need normal Tumblr OAuth access and not require XAuth approval.

Source: github.com

    • #wordpress
    • #tumblr
    • #ruby
  • 8 months ago
  • 6
  • Comments
  • Permalink
  • Share
    Tweet

About

Avatar

I'm Tejus Parikh and this is my blog about programming, startups, and other technology related topics.

The vast majority of the posts are about Java or Ruby code, with a few about startups or gadgets thrown in for color.

You can learn more about me on Github and my personal homepage.

Me, Elsewhere

  • @vi_jedi on Twitter
  • Facebook Profile
  • Linkedin Profile
  • vijedi on github

Twitter

loading tweets…

  • RSS
  • Random
  • Archive
  • Ask me anything
  • Mobile

Effector Theme by Carlo Franco.

Powered by Tumblr