Define authenticate() handler on backend