Finished most of auth code.