Add generate_token function

Sometimes it's useful to generate a JWT for a user without having to call the auth endpoint, e.g. in tests. This exposes this functionality through a `generate_token` function.