Add Variable Parameters To Any Request

Let me outline the problem. I have embedded pretty URLs into my application. E.g. user can access site using:


http://example.com/action/login

or


http://example.com/viewPost/1234567

or


http://example.com/bestPosts

I would like to add silent-login feature. E.g. when I send newsletter to the users, URLs look like following:


http://example.com/viewPost/1234567?loginToken=qwerty

When user follows the link, they get logged in and redirected to


http://example.com/viewPost/1234567

The question: how technically implement the idea?