Using Auth0 to get text (.txt) file content from Google Drive

Hi,

I followed a tutorial here:

I am testing Alexa skill and wish to use account linking to Google Drive using Auth0. What should be done in order to get a text (.txt) file content from Google Drive?

I was able to get the authorization token, but have no idea how to get the text file from Google Drive.

Thanks.

Once you’ve received the authorization token, all activities would be then controlled by your interaction with Google Drive. We don’t have any control over the Google Drive API or how to interact with it.

A good starting point for you though would be the Google Drive API File reference found at Files  |  Google Drive  |  Google Developers

1 Like

Hello,

My case was that i was able to get the token, but when using the Google Drive API, the https GET response was a “return code: 401” error, which is an unauthorized error. It seems that Google Drive cannot authorize the Auth0 domain. How to make Google Drive to authorize Auth0 domain?

Here was the code i tested according the the tutorial for reference

let token = this.getAccessToken();
let options = {
method: ‘GET’,
// url: ‘https://jovotest.auth0.com/userinfo/’, // You can find your URL on Client → Settings →
// Advanced Settings → Endpoints → OAuth User Info URL

url: 'https://www.googleapis.com/drive/v2/files', 	// wish to list the files in the google drive account, and if my target file exist, 
													// the next step will wish to use the following Google Drive API:
													// url: 'https://www.googleapis.com/drive/v2/files/fileId',


headers:{
    authorization: 'Bearer ' + token,
}

};

// API request
request(options,(error, response, body) => {
if (!error && response.statusCode === 200){

    let data = JSON.parse(body); //Store the data we got from the API request
    console.log(data);
    /*
    To see how the user data was stored,
    go to Auth -> Users -> Click on the user you authenticated earlier -> Raw JSON
    */
    this.tell('Hi, ' + data.given_name);
} else {
    this.tell('Error');
}

}

I don’t believe this is anything that we can assist with as it would seem to be something related to the code and process you’re using / testing which comes from another vendor / site. I suggest reaching out to them.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.