Added authentication option

You can now set up a function to handle authentication.