Create a new auth package for authentication related codes
Reorganized the code into a auth package
Working code with new tpid in the reply_url
Added custom error to handle unauthorized