login before api call