Save tokens in local storage

Fixed issues with error handling.
Implemented support for storing tokens in the localStorage of the inApp
browser.