Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

[Update] Always use OAuth 2.0 with Google Picker API

1,015 views
Skip to first unread message

Kuntal Loya

unread,
Dec 9, 2013, 9:56:27 AM12/9/13
to google-p...@googlegroups.com
Hi everyone,

If you are already using the Picker API with OAuth 2.0, you can skip reading.
If you are creating the Picker dialog with Views that deal with user's data, like, Photos, Drive items, Youtube videos, etc, you need to now pass the oauth_token to the google.picker.PickerBuilder using its setOAuthToken method.

What to do?
  • Obtain the OAuth token by following the instructions here. Make sure you pass the appropriate scopes while obtaining the token depending on the Picker Views you are creating.
    You can see the list of scopes for different Picker Views here.
  • Pass the obtained OAuth token to the instance of google.picker.PickerBuilder using its setOAuthToken method. This method should be called before PickerBuilder.build() is called.
See example.

Please switch to using OAuth by Jan 15, 2014 after which Picker will stop working without OAuth token.
Let us know if you have any issues.

Thanks,
Google Picker API Team

Ivan Novikov

unread,
Jan 24, 2014, 6:21:46 PM1/24/14
to google-p...@googlegroups.com, kun...@google.com
Hi Kuntal,

I posted a separate message about this earlier today, the gist is that when I start using setOAuthToken, DocsUploadView breaks. When I just removed the setOAuthToken call, things went back to normal, i.e. files can be successfully uploaded.

I double-checked that the token I pass to setOAuthToken has correct scope (.../auth/drive) by looking at scopes in the same "authorization result" object that contains the token.

Could you pls hold off a bit on disabling the old behavior while the issue with uploads is being clarified, and I would appreciate any workarounds you can suggest.

Thanks,
Ivan

Tom Cowley

unread,
Jan 26, 2014, 10:33:34 AM1/26/14
to google-p...@googlegroups.com, kun...@google.com
I too have just disabled setOAuthToken, and now files can be uploaded. When it is enabled, the server is rejecting it each time. 

Kuntal Loya

unread,
Jan 27, 2014, 12:36:23 AM1/27/14
to Tom Cowley, google-p...@googlegroups.com
Thanks for the report. We'll check out what the possible issue is here, and get back to you. Do you have a demo page you can share with us, where the issue can be repro-ed.

We'll keep the old behavior around till this issue is resolved.

Thanks for your patience,
Kuntal

Tom Cowley

unread,
Jan 27, 2014, 11:55:24 AM1/27/14
to google-p...@googlegroups.com, Tom Cowley, kun...@google.com
I'm afraid I can't provide a demo page, but I'll put the code snippet below. I'm using refresh tokens for authorization. Like I say, it has worked fine the last few months using setOauthToken, but now files will only successfully upload if that line is removed.

function createPicker() {
var view = new google.picker.DocsUploadView()
.setParent("0B0MdHztEbMzmV3BGU1d6Uzg1Q1E");//this is the folder to upload into
var developerKey = '***';
var picker = new google.picker.PickerBuilder()
.enableFeature(google.picker.Feature.MULTISELECT_ENABLED)
.addView(view)
.hideTitleBar()
.addView(new google.picker.View(google.picker.ViewId.DOCS))
                //.setOAuthToken(globalOAuthCode) <- must be removed to now work
.setDeveloperKey(developerKey)
.setCallback(pickerCallback)            
.build();
picker.setVisible(true);
}

Thanks again for any help :)

Ivan Novikov

unread,
Jan 27, 2014, 12:37:02 PM1/27/14
to google-p...@googlegroups.com, Tom Cowley, kun...@google.com
Kuntal,

Thanks for your reply, here's a simple demo page: http://test-picker-upload.appspot.com/

Ivan

Jon Emerson

unread,
Jan 27, 2014, 4:21:36 PM1/27/14
to google-p...@googlegroups.com, Tom Cowley, Kuntal Loya
Hey everyone -

The issue is now fixed, as of around 11:50am PST.  We were able to fix it via a live configuration change.  Sorry for the difficulty and thanks for reporting the bug.



--
You received this message because you are subscribed to the Google Groups "Google Picker API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-picker-...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Jon Emerson | Babbling Crazy Person | jonem...@google.com | 415-706-8528

Lorenzo Bugiani

unread,
Feb 3, 2014, 10:06:05 AM2/3/14
to google-p...@googlegroups.com, Tom Cowley, Kuntal Loya
Hi all,

I've a similar issue regarding upload of files.
I've an old project that doesn't use Oauth2 token, so I've updated it as the doc say.
In my case the code won't work because the access token is null, but coming back to the old code (that doesn't use OAuth2 token) all works well...

Kuntal Loya

unread,
Feb 3, 2014, 10:15:12 AM2/3/14
to Lorenzo Bugiani, google-p...@googlegroups.com, Tom Cowley
Hi all,
Just an update - The change enforcing OAuth in Picker has been delayed to 15 April, however it is highly recommended, that you create the Picker with an OAuth token.

Thanks.

Ignacio Zafra

unread,
Feb 20, 2014, 3:47:40 AM2/20/14
to google-p...@googlegroups.com, Lorenzo Bugiani, Tom Cowley, kun...@google.com
Hi,

It has stopped to work without Oauth 2.0, although two months left 15th April.



Thanks.

Best regards, Ignacio

___
Nota:
 Según la normativa vigente en materia de Protección de Datos de Carácter Personal, le informamos que sus datos han sido incorporados a un fichero denominado "Clientes y/o Proveedores" creado por resolución de la Agencia Española de Protección de Datos y del que es responsable "The Cloud Gate S.L.", con CIF: B-18961433. La finalidad del tratamiento de sus datos es mantener la relación contractual existente o mantenerle informado de novedades y noticias que puedan resultar de su interés. Le informamos que usted puede ejercitar sus derechos de acceso, rectificación, cancelación y oposición, mediante escrito dirigido a: "The Cloud Gate S.L.", Calle Campo Verde 4, 3ºC , 18001 - Granada, o mediante email a la siguiente dirección de correo electrónico: in...@thecloud.es La información incluida en este e-mail es CONFIDENCIAL, siendo para uso exclusivo del destinatario arriba mencionado. Si usted lee este mensaje y no es el destinatario indicado, le informamos que está totalmente prohibida cualquier utilización, divulgación, distribución y/o reproducción de esta comunicación sin autorización expresa en virtud de la legislación vigente. Si ha recibido este mensaje por error, le rogamos nos lo notifique inmediatamente por esta misma vía y proceda a su eliminación. "
nubbius" es una marca registrada por The Cloud Gate S.L.

This information is private and confidential and intended for the recipient only. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an official statement from The Cloud Gate, S.L. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice. 
"nubbius" is a registered trademark of The Cloud Gate S.L.
Reply all
Reply to author
Forward
0 new messages