Turns out that Starlette's url_for looks for the Route name, which is by default the name of the endpoint provided when making the Route object. In this case, it would be get_token, not token