Have a question about CiviCRM? Get it answered quickly at the new CiviCRM Stack Exchange Q+A siteThis forum was archived on 25 November 2017. Learn more.How to get involved.What to do if you think you've found a bug.
I agree that the key is a pain without good purpose, having to keep both the session AND maintain a key in the URL just duplicates effort. If the attacker is good enough to hijack a session, they can beat a GET parameter without issue. I would expect if they can pick off the URL,they can manage to hijack the session as well. Even with that resolved, NEVER use this API without SSL.
I posted on the blog (http://civicrm.org/node/412) a couple months ago that we're working on getting a PHP library written to go against the REST API, and that our vendor has agreed to allow us to open source the library once it's completed.
As soon as I have the library in hand, I'll work out a way to get it shared and provide documentation for it. I wrote up some detailed docs for using the API that I gave our vendor to start out the project. I'd be happy to share those now if it would be helpful to others.
I'll work on getting the stuff I wrote into the wiki later today.
I'm happy to put some work into getting the code for the REST interface updated to store the keys someplace other than in the session, but what do we need to do to create that place.Someone needs to decide if the keys are static, and generated through the web interface and copied into the app, or if the keys are generated by a login at the start of the process.
I wondering if allowing either instead of requiring both might be the way to go. For the AJAX interfaces to come, sessions might be easier since it could be maintained by the browser, and not require the coder to do much in the JavaScript. However, when doing server-to-server work (which is what I'm interested in at the moment), the session just adds a layer of complexity. I'm okay with the login requirement for server-to-server work, but having to maintain both the session cookie and the key is just redundant. If the session allowed AJAX develops not to have to authenticate again (since the user has already done that) it should make that easier as well.
@Lobo, I can't find a way of setting the active user without providing the pwd to the authenticate method. Does it exist ? (would be magic on the cli, more improvements on that area before the code freeze).