Look for "App Zero" on the community forum I think which shows you how to do this, but be aware that API is being replaced as we speak by a SAFE Node.js thing that I've not looked at yet, and is not yet documented (but exists in the repo). Authorisation should be very similar though, so I don't think you are necessarily wasting your time.
If you want to test locally, easier in the long run, you can do this with the polyfill as Joseph said - you can get this from the repos too, and there are topics explaining how to do this if you search (eg for polyfill).
In case you have not realised yet, to can often see what's wrong using the browser debugger console (Shift-Alt-J or K or something!). So open this and then load your page and see what output it generates. You'll also be able to set breakpoints, inspect variables etc.
Sorry I don't have time to dig the links out just now but say if you can't find what you need and someone will help. Good luck