Google Drive gapi.client.init not working in iOS build

I have an app that accesses Google Drive which works when running as a web app in both Chrome (Windows 10) and in Safari (iOS 13.4) but when I perform an iOS build in Appflow, which succeeds, the app fails when trying to initialise the gapi client.

Sequence of events is:

  • Client connects to a server to authenticate - server connects to Google Drive account and using a refresh token acquires an Access token which is returned to the client

  • Client loads the gapi client, using a callback to return: gapi.load(‘client:auth’, callback);

  • Client then calls the gapi client init function:

          const DISCOVERY_DOCS = ["https://www.googleapis.com/discovery/v1/apis/drive/v3/rest"]
    
          gapi.client.init({ discoveryDocs: DISCOVERY_DOCS })
              .then(() => {
                  gapi.client.setToken(token); 
                  return true
              }, (err) => {
                  return err;
              })
    

The gapi.client.init never returns, does not resolve or reject.

This always worked when the build was done with Phonegap but that was with the soon to be deprecated macOS build stack whereas, with Appflow, I’m using the latest macOS build stack.

Has anyone come across this before and anyone able to point me in the right direction to try and resolve this.

Thanks, BP