adjusted namespacing and SPobject access. As off initial version. There is a 400 bad request exception when pressing the authorize button.
clean up
made it work