saving keys and token into database