Call back function not defined

Hi,
I created an element with a js code that includes a call back function, something like that:

If I put the call back function, on the header, all works well.
If I put the call back function inside the action code, it says auth is not defined.
Any suggestions?
Thanks.