Closed indapublic closed 5 years ago
I am facing the same issue
@kevalbhatt I decided this by removing component and rewriting the code using Google API
I too am experiencing this issue.
@noachr should be fixed in 0.0.9
could you please let me know what are the issues you are seeing in your console?
@sdoomz I'm facing the same issue in a project that's unrelated to this (doesn't use react-google-picker). Could you point me to the commit that fixes it, please?
@schani probably you need to do something like https://github.com/sdoomz/react-google-picker/commit/b0d58eadf7a9d8c5e2acbccbf05afd3395f0b3c2#diff-4794d8bb386ede74f530ac134188922bR99
@sdoomz Doesn't that just show an error message when the auth fails?
@kevalbhatt I decided this by removing component and rewriting the code using Google API
You can avance with that? I can't get that working. Im facing with that error:
Invalid 'X-Frame-Options' header encountered when loading 'https://docs.google.com/picker?protocol=gadgets&origin=http://localhost:3020&navHidden=true&multiselectEnabled=true&hostId=localhost&relayUrl=http://localhost:3020/favicon.ico&nav=((%22all%22,null,%7B%22mimeTypes%22:%22image/png,image/jpeg,image/jpg%22%7D))&rpctoken=boautxffui7d&rpcService=p0iclbccx8wa&thirdParty=true&ppli=1': 'ALLOW-FROM http://localhost:3020' is not a recognized directive. The header will be ignored.
If someone still got stuck on this, like me, I had to add this to the picker initialisation:
.setAppId(appId)
So something like this:
const picker = new window.google.picker.PickerBuilder()
.addView(view)
.setOAuthToken(oauthToken)
.setAppId(appId)
.setDeveloperKey(developerKey)
.setCallback(onChange);
// Replace with your own project number from console.developers.google.com.
// See "Project number" under "IAM & Admin" > "Settings"
Edit: Still doesn't seem to work for all user accounts :(
Edit2: Changing "https://apis.google.com/js/api.js" to "https://apis.google.com/js/client.js" also seems to help.
Edit 3: And now for the actual fix; I switched to "auth2".
window.gapi.load("auth2");
instead of window.gapi.load("auth");
And doAuth becomes:
const doAuth = (callback) => {
window.gapi.auth2.authorize(
{
client_id: clientId,
scope: scope.join(" "),
immediate: authImmediate,
},
callback
);
};
Gist here: https://gist.github.com/happylinks/0443f283cc4f1c05988608425b2426b0
Hi. Thanks for your awesome component. But I need help.
My code:
Sometimes I receive this window and nothing happens when I clicked on
Sign in
buttonHave you encountered this?