I'm implementing a Rails app using Devise for most of the user authentication work. One thing I've noticed is that, when passing identifiers around for security-sensitive tasks, they're always done using query string parameters.
For example, the URL included in the password reset email sent to users might look something like this:
http://example.com/users/password/edit?reset_password_token=_aPKoNpLHm7HYs_o4Qex
Devise looks up the user based on the reset_password_token
and changes the password when the user resets the form.
I just implemented a similar function that's not handled by Devise. In every email, I include an unsubscribe link. The controller looks up the user based on a unique token and sets their unsubscribe flag to true, even if the user is not logged in.
However, the URL I generate looks like this:
http://example.com/subscription/3e7eb22a268b62d5/edit
This is, basically, the same thing that Devise is doing. The difference is that I include the token in the URL path itself rather than the query string.
In my mind, this is more RESTful, as it points to a specific resource (the subscription in question) that the user then updates (by posting the form to PUT http://example.com/subscription/3e7eb22a268b62d5
). Beyond that benefit, I don't see any difference between the two methods.
Is there something reason I'm missing to use a query string parameter over a RESTful URL?