Fix and add type declarations for the auth system