Testing the API w/ OAuth

Last modified: 28 March 2012
  1. If you're testing against your local dev machine:
    1. Go to your local App Engine's interactive console via the admin panel (usually http://localhost:8080/_ah/admin/interactive, or run tools/devshell.py), and run the following:
      from oauth_provider import models_oauth
      r = models_oauth.Resource(name="default")
      r.put()
    2. It's easiest to test against Facebook identities (by a long shot, due to the dev server's inability to handle more than one request at a time). So... Follow the Facebook integration docs to get Facebook integration up on your site
    3. Get an API consumer key/secret from http://localhost:8080/api-apps/register
    4. Especially if you're testing the iOS app, you might find it convenient to change the key/secret of the consumer you just created:
      c = models_oauth.Consumer.all().get()
      c.key_ = 'monkey'
      c.secret = 'monkey'
      c.put()
  2. Clone the repo at https://github.com/khan/khan-api, which contains a little API test app.
  3. Follow the steps under "Examples" at https://github.com/khan/khan-api#readme
Comments