7 Replies Latest reply on Jul 25, 2016 1:29 PM by Brendan Lee

    Deploying the Google Sheets Connector Locally

    Chris Pare

      Lots of questions:

      • Our Tableau server is 9.3.1 (both 32 and 64bit)
      • I have deployed the following files in webdataconnector-master.zip - is this correct, or should I be deploying from webdataconnector-gh-pages.zip
        • googleSheetIcon.png

        • GoogleSheetParser.js
        • GoogleSheetsConnector.html
        • GoogleSheetsWDC.js
        • IncrementalUpdateConnector.html
        • jsonConnector.html
      • I then updated the GoogleSheetsWDC.js to reflect the correct "EXPECTED_REDIRECT_URL"

       

      The above seemed to work, and I could query for a public sheet without problem, however when I hit the "Sign In" button I am receiving a 400 error on Google.

          Invalid parameter value for redirect_uri: Non-public domains not allowed: https://servername/webdataconnectors/GoogleSheetsConnector.

       

      I assume this is because the server name is not FQDN, so I changed the GoogleSheetsWDC.js "EXPECTED_REDIRECT_URL" to the FQDN, however that's not able to be resolved - how can I get tabadmin command to output the FQDN address in hopes of getitng this working?

       

      Also - If I am just completely in the dark please let me know - I haven't found any good deployment documentation for this sample...

        • 1. Re: Deploying the Google Sheets Connector Locally
          Nick Hughes

          Have you tried Tableau 10? The native Google sheet connector is beautiful

          • 2. Re: Deploying the Google Sheets Connector Locally
            Chris Pare

            The intent is to have this released to production immediately - we patch/upgrade every 6 months, and just upgraded to 9.3.1 a few weeks ago - Tableau 10 won't make it here in a production capacity until December.

            • 3. Re: Deploying the Google Sheets Connector Locally
              Brendan Lee

              Hey Chris,

               

              Unfortunately it's a little more complicated than that.  The Google Sheets sample WDC uses a authorization called OAuth to do it's authentication.

               

              At a high level, how it works is you create an application with google and configure that application.  That application will come with a client ID and a secret that uniquely represents that app.  And you also be able to configure that app with the correct redirect URL of your server. 

               

              The current sample is using the client ID of the Google app of the person who wrote the sample.  That app doesn't know about your specific redirect URL.  So what you'll have to do is create your own google app and then use your client ID, that should work.  You may find some additional tinkering is required.  That WDC was meant to serve as a developer sample, and as such isn't production quality. 

               

              Hope that helps!
              Brendan

              • 4. Re: Deploying the Google Sheets Connector Locally
                Chris Pare

                Again, I may be in over my head, but your description doesn't explain why I am able to report against a "Public" sheet without issue, but can't hit the "Sign In" link without receiving a 400 error about a public domain.  This all works on the github.io hosted app, even when trying to get to data that requires us to authenticate - I simply want the same functionality on my internally hosted site.

                 

                I guess I really want to see tabadmin spit out a fqdn rather than a server link URL when I register the web connector - what's required to get that to happen?

                • 5. Re: Deploying the Google Sheets Connector Locally
                  Brendan Lee

                  For any public sheet, we don't actually need any sort of authentication.  So the issue I was outlining doesn't apply for public sheets since it only deals with the Authentication flows.

                   

                  It actually would be impossible for us to create any sort of tabadmin command for this process.  The reason is that we don't know the domain name of your server.  At a core what is happening is that you, as the developer, need to establish a trust relationship with the OAuth provider (Google).  Google needs to know that it can trust the requests coming from the OAuth application.  It does this by associating the OAuth application credentials with specific URLs where the requests are coming from.

                   

                  While we don't have any documentation for the Google example, we do have a tutorial that walks through building a connector from scratch the uses OAuth.  This tutorial has all the baseline knowledge you would need in order to be able to modify your google sample to work from your server location: Web Data Connector OAuth Tutorial  Part 1: Introduction and Overview.

                   

                   

                  -------

                   

                   

                  However, I want to make sure you are aware of a one important detail before you proceed with this work.  If your goal is to support refreshes on server, you will need to do additional, non-trivial work on the WDC. 

                   

                  At a high level, the end result of the OAuth flow is an access token.  This represents permission to access a user's resource (in this case a Google Sheet).  These access tokens expire after a short amount of time.  When this happens, the WDC will not be able to get the latest data.  There are ways to get around this, but it may require significant work.

                  • 6. Re: Deploying the Google Sheets Connector Locally
                    Chris Pare

                    Shouldn't all the functionality we get with the github.io link be in the github project and download?  At the github.io site we get all the functionality we need, I just can't get it to deploy internally and we can't have our data flowing through github.io

                    • 7. Re: Deploying the Google Sheets Connector Locally
                      Brendan Lee

                      The issue is that the one on github is configured for that location, and for the Tableau Google Application.  In that sample code, you will see some lines like this:

                       

                      //Client ID registered with Google. Each application needs its own (replace this with yours)

                      //OAuth tokens returned from Google are only valid in the context of this app-id, which includes

                      //the redirect url

                      function gscGetOAuthAppId()

                      {

                          var clientID = "757476412337-o2e3ss2k1jirl3jjb699o7em6p1qa0ut.apps.googleusercontent.com";

                          return clientID;

                      }

                       

                      //Expected redirect url for OAuth connections, this value is where the local HTTP server should be hosted at

                      //for the OAuth redirect, otherwise the OAuth connection will fail. To change this value please create your

                      //own OAuth App ID that uses a different base URL to host the connector.

                      var EXPECTED_REDIRECT_URL = "http://tableau.github.io/webdataconnector/Examples/GoogleSheetsConnector.html";

                       

                      ----------

                       

                      With these configurations, the google sheets WDC will only work correctly when hosted at that specific location and associated with that specific client application.  These are the things you would need to change (in addition to setting up Google app) in order to get this sample hosted on an internal location.