handled login. storing apiKey.