Setting the API token per request

peeja's Avatar

peeja

23 Jan, 2009 08:27 PM

I'm writing an app in which people can log in using their Lighthouse token to connect to Lighthouse. Thus, I need to be able to set the token used for each request, rather than set it globally.

Did I hear that there's a new Ruby API library coming? And if so, will it make this possible? Or should I roll my own?

  1. 1 Posted by Justin Palmer on 23 Jan, 2009 08:58 PM

    Justin Palmer's Avatar

    You can append the token to the url using the _token param.

    So you could do:

    Project.find(:all, :params => {:_token => "YOUR TOKEN"})
    

    If you're using the methods defined in the api like 'tickets', you can exclude the outer :params hash.

    @project.tickets(:_token => "YOUR TOKEN")
    

    I believe this should work, let me know if it doesn't.

  2. 2 Posted by peeja on 23 Jan, 2009 09:01 PM

    peeja's Avatar

    It works! Thanks, Justin.

Discussions are closed to public comments.
If you need help with Lighthouse please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac