I’m trying to get some authorization set up to use the Google BigQuery API for my app. It needs oAuth2 or a Service Account authorization and it seems the easiest way to go is to use their Google Auth Library for NodeJS.
I’ve installed it via NPM, and just trying to run the basic code to access my JSON Web Token.
My question is just around using JS files that have the ‘require’ syntax, not sure how to use in wappler to require the google-auth-library installed in the node-modules folder.
Here’s a snippet i’m trying as per the google docs:
But I’m getting this error message in the console:
auth.js:1 Uncaught ReferenceError: require is not defined at auth.js:1
Any thoughts or general direction on this? is ‘require’ ES6 syntax that isn’t supported? Is it just a matter of getting the right address in the require statement?
For wnyone that reads this, it seems this is a common JS issue… or more a lack of understanding on my part.
the require() syntax that is usually used to reuire Node modules, doesn’t work in browsers/client-side and needs to be packaged by something like Babel, Browserify or WebPack to be used properly.
THanks @George. I did manage to download Browserify and get that to bundle a JS file to include the 'required' files.
Turns out that wasn't really the solution to my problem. I'm trying to get Google authorization set up when i need to use a Service Account (which is outside of the current Wappler capabilities I believe)
Not sure what you want to do but if you use server connect oauth actions you can use there the google service accounts to get all kind of authorizations
There was a big thread from @psweb a few months ago but not sure if it was solved.
The service accounts seem like they would be used in a B2B/SaaS setting as its the only way I can see that allows the app to use the Google APIs without the user involved, including CRON jobs.
I’d love it if it could be incorporated, as manually doing it is proving difficult