The problem relates to Google API Javascript client (still in beta since 2014 ?)
More specifically it relates to sheets V4 API
I adapted the browser-side auth sample to work with this API
I tested it with the calendar v3 API and it works fine all the time
The page is served by full updated debian/jessie nginx (default install) on my own domain http port 80 (no proxy)
Api Key and Client Id are well set as well as the Origin URL
the call to
gapi.auth.authorize
succeeds all the timethe call to
gapi.client.load
fails intermittently
It works well once and then fails ~10 times when I refresh the page
Vice-versa if I code a retry loop, it fails ~10 times (always same) before working
error:Object
code:400
message:"Bad request: Origin doesn't match Host for XD3."
status:"INVALID_ARGUMENT"
The error occurs during this http api discovery call :
https://content.googleapis.com/discovery/v1/apis/sheets/v4/rest?fields=kind%2Cname%2Cversion%2CrootUrl%2CservicePath%2Cresources%2Cparameters%2Cmethods&pp=0&key=<my api key>
Any idea Thanks