'Get the user token from a request
- in URL parameters: ?token=<token>
- in header: Authorization: token <token>'

def get_token(self, handler):

    user_token = handler.get_argument('token', '')
    if (not user_token):
        m = self.auth_header_pat.match(handler.request.headers.get(self.auth_header_name, ''))
        if m:
            user_token = m.group(1)
    return user_token
