How to obtain the Refresh Token for a Google Big Query Linked service


  • Hi everyone, 

    Up until now we've been working with Data Factory v1 and now we're starting to try out some of the new connectors that v2 has to offer.

    We've been trying to set up a connection to BigQuery but without success.

    What we have so far:

    In, panel control we have our project and we've created credentials (type: other) and now we have out client ID and our client Secret. The thing is, when creating a BigQuery linked service with User Authentication, we need to input a Refresh Token, which from what I've seen is obtained with the Client ID and Client Secret, but we haven't found anywhere where this is explained or done.

    So, any amount of help would be greatly appreciated.



    Monday, April 16, 2018 2:41 PM


  • Hi all, 

    After much trial and error I've been able to solve this. Here's how I accomplished this in case anyone runs into the same issue:

    First of all, after creating your credentials in the google developers panel control of your app, download the credentials json, should be named something like client_secret_12345.json.

    Inside this json, grab the redirect uri, the client ID, and the client secret. You'll need these to obtain an authorization code from googleapis. You should now build a request such as: include_granted_scopes=true&state=state_parameter_passthrough_value&redirect_uri=YOUR_REDIRECT_URI& response_type=code&client_id=YOUR_CLIENT_ID&response_type=code

    Go to this location with your browser and it'll propmt you to enter your google username and password. Once you're in, it'll show you your authorization code. Keep this code, as you'll need it for the next step.

    Finally, build a POST request with the following body parameters:

    • grant_type = authorization_code
    • redirect_uri = YOUR_REDIRECT_URI
    • client_id = YOUR_CLIENT_ID
    • client_secret = YOUR_CLIENT_SECRET

    For some reason, we couldn't get it to work with content_type: application/json, so we used a REST client and set the content_type to x-www-form-url-encoded.

    This will return an object with the refresh token. 

    Hope this will be useful for someone!

    • Marked as answer by Joan Cardona Tuesday, April 17, 2018 7:15 AM
    Tuesday, April 17, 2018 7:15 AM