fix post request to fetch token and get endpoints