def token_ep(auth_domain):
    """Construct the token endpoint URL, given the authentication domain."""
    if auth_domain.endswith("/"):
        return "%soauth2/token" % auth_domain
    return "%s/oauth2/token" % auth_domain