google-app-enginegoogle-gadget

Can a Gmail gadget use users.get_current_user()?


I'm trying to get the current user for a Gmail gadget, but it seems users.get_current_user() returns None, even though I'm obviously logged in.

Am I missing something?

Thanks in advance.


Solution

  • You can't use the Users API directly within a Gmail gadget, but you can use a combination of OpenID and the gadgets APIs to authenticate your users. The document was writing in the context of a Gmail contextual gadget (which is installed via the Google Apps Marketplace), but the principles will still apply for non-contextual gadgets.

    The biggest difference between what is outlined in the document and what happens in a non-contextual gadget is that Google Apps Marketplace applications (and their companion gadgets) are automatically whitelisted for OpenID. Without a Marketplace install, users will see an OpenID approval screen the first time they load your gadget.