Fully support the token api.

Also, use our own patched version of httpinvoke.