Open Knightabhi opened 2 years ago
I am also stuck at the same point, I have migrated gapi authentication to GSI but the picker does not open after authentication nor is it given any error in the console or elsewhere.
@Knightabhi @Jose-cd @Jose-DM could you please look into this for me, thanks in advance.
I have used gapi directly without this package in react it is working now. just use google sample code for javascript. You have to do some changes
I have used gapi directly without this package in react it is working now. just use google sample code for javascript. You have to do some changes
This sounds good, could you please list briefly the changes you did.
refer to https://developers.google.com/drive/picker/guides/sample
add this to index.html
add this inside useeffect const SCOPE = "https://www.googleapis.com/auth/drive"; const gapiLoaded = () => window.gapi.load('picker',gisLoaded(), intializePicker); function intializePicker() { pickerInited = true; }
function gisLoaded() {
tokenClient = window.google.accounts.oauth2.initTokenClient({
client_id: "",
scope: SCOPE,
callback: "", // defined later
});
console.log(tokenClient)
gisInited = true;
}
const script = document.createElement('script');
script.src = "https://apis.google.com/js/api.js";
script.async = true;
script.defer = true;
script.onload = gapiLoaded;
document.body.appendChild(script);
console.log("google loaded");
return () => {
document.body.removeChild(script);
};
The rest is the same from the sample javascript
@Knightabhi I am still unable to keep things in place properly in reactjs project, could you provide an index.html and App.js file with a minimum piece of code to open the picker. It's urgent. I am being around it since last month.
The error I am unable to fix yet is,
'google' is not defined
while calling the createPicker function in App.js.
use window. in front of google for every such error
after using a window with all the not defined variables, the picker is opening but still getting this error. @Knightabhi
Did you enable file picker API in your project? If not, do it, I think, then it will run.
I have enabled it, yet the same issue.
can you share your code
I have modified paste it and put client id
you will need api_key and app_id
google is still undefined :(
Could you please once verify the index.html file
index.txt paste this
Joined the gmeet - are you there?
In version 1.2.0 everything works. Check it
Thanks, @V7074 and @Knightabhi , I have set up the react project, and am able to play with the picker properly, Now I want to upload the complete folder (i.e. recursively, upload all the subfolder if there are any). But it is allowing to upload files only, I want to upload a complete folder, recursively as well if it has any subfolder.
@V7074 @Knightabhi it's urgent, can we somehow upload the whole folder into the drive using picker?
@rajesh-twg @twgadmin Hi, guys. I’m no longer studying the topic related to google drive picker, so I can’t help you with your questions, sorry.
I am not sure. Maybe you can get the location where the user wants to upload from the picker and then use drive API to upload the folder.
Hi,@Knightabhi already tried solution you suggested above (app.txt ) but still getting error/issue(picker api in google console is enabled). urgent help please @Knightabhi .
Hi,@Knightabhi already tried solution you suggested above (app.txt ) but still getting error/issue(picker api in google console is enabled). urgent help please @Knightabhi .
use the latest release of https://www.npmjs.com/package/react-google-drive-picker, it is working fine for me.
I am getting a 200 response code but in response this is present {"valid":true,"blocked":true,"suppressed":false}
no error in the console either. Any suggestion or code that is working (version of the package that is working) I just need the file id of selected file to download through a batch job
thank you