pythongoogle-app-enginerestrestful-authenticationtipfy

How do I secure REST calls I am making in-app?


I have an application that has a "private" REST API; I use RESTful URLs when making Ajax calls from my own webpages. However, this is unsecure, and anyone could make those same calls if they knew the URL patterns.

What's the best (or standard) way to secure these calls? Is it worth looking at something like OAuth now if I intend to release an API in the future, or am I mixing two separate strategies together?

I am using Google App Engine for Python and Tipfy.


Solution

  • Definitely take a look at OAuth

    It is quickly becoming the "de-facto" standard for securing REST APIs and a lot of big companies are using it, including Google, Twitter and Facebook just to name a few.

    For Python on GAE you have two options:

    The most straightforward way (IMHO) is using David Larlet's library for OAuth Support in Django available on BitBucket.

    But since you're not using Django, maybe you want to take a look at the python-oauth2 library that's available on GitHub, and is considered the most up-to-date and unit-tested implementation of OAuth for Python 2.4+.

    Either way I think you'd be much better using OAuth than rolling your own service security solution.