[Snowy] OAuth hurdles



Hi list,

I've recently tried to make Tomdroid and Snowy play along, even though
the web interface seems to be in a beta state, I can't wait for the
day I'll be able to use it full time. I've gone as far as having the
application authenticate with Snowy and get some notes through the
API.

I don't know anything about python or OAuth, so it hasn't exactly been
a smooth ride. I'll detail a few of the stumbling blocks I've
encountered along the way. The first ones are not that complicated to
get around:

* The first one is not a bug in Snowy per se, but I believe it would
be nice to mention it in the readme. Launching snowy with 'python
manage.py runserver' restricts the access to localhost, which isn't
really useful when testing it with a phone connected to the local wifi
network. It was as simple as appending 0.0.0.0:8000 to the command
line but I lost quite a bit of time looking for this tip.

* When trying to add an OAuth consumer through the admin interface, it
insisted on sending a mail at the end of the process. The template
didn't exist, resulting in a nice error. I fixed this by creating an
empty file at notes/templates/api/mails/consumer_accepted.txt.

* When not logged in, trying to access the application authorization
form yields a 404 error as it tries to redirect me to
http://192.168.1.96:8000/accounts/login/?next=/oauth/authenticate/?oauth_token=kPV3GWC3HfxmAddE6Q&oauth_callback=
. This worked fine when previously logged in though.

The following ones puzzled me a bit more:

* I tried to pass a callback URL, of the form tomdroid://sync, to the
request token endpoint to have the application raised automatically at
the end of the authorization process. The problem is, an error "Access
not granted by user." was returned, even though I correctly filled the
authorization form. The hidden oauth_callback field is defined as an
URLField, resulting in an error when trying to validate it with this
kind of non-http URL. I bypassed this by changing it to a TextField in
lib/piston/forms.py.

* Accessing a single note through the API results in a server error:

Piston/0.2 (Django 1.1 beta 1) crash report:
Method signature does not match.
Resource does not expect any parameters.
Exception was: read() takes exactly 5 non-keyword arguments (4 given)

I fixed this by removing all mentions of slug in NoteHandler.read but
I really have no idea of what I'm doing here.

Well, that's all for today :-) .

Benoît Garret


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]