So No matter what the error is portfolio throws bogus error messages which is of no use at all.
So I had APIs disabled in Google developer console.
And this is the error that I get in Moodle -
Debug info:
Error code: failedtosendpackage
Stack trace:
line 516 of /lib/portfolio/exporter.php: portfolio_export_exception thrown
line 227 of /lib/portfolio/exporter.php: call to portfolio_exporter->process_stage_send()
line 233 of /lib/portfolio/exporter.php: call to portfolio_exporter->process_stage()
line 233 of /lib/portfolio/exporter.php: call to portfolio_exporter->process_stage()
line 233 of /lib/portfolio/exporter.php: call to portfolio_exporter->process_stage()
line 233 of /lib/portfolio/exporter.php: call to portfolio_exporter->process_stage()
line 265 of /portfolio/add.php: call to portfolio_exporter->process_stage()
Looking futher we have this -
throw new portfolio_plugin_exception('sendfailed', 'portfolio_gdocs', $file->get_filename());
Which should be improved to show the actual error.