Updated auth

Resolved issue with "already_exists" status and make code more flexible and exntendable