Replace setAuthSession() by registerAuthSession()

now setAuth($auth) will set the auth depending the mode we are using