fix #authorize with user key

When using plain `authorize` user_key param wasn't recognised.
This PR also refactors the code for serializing params.