Hi Tyler,

Gwyn's answer is especially good if your back end is running on App Engine.
 For the more general case where you are running your own servers, please
see "Single sign-on within
gadgets<http://code.google.com/googleapps/marketplace/best_practices.html#gadget_sso>"
and the surrounding information on Authentication Best Practices (
http://code.google.com/googleapps/marketplace/best_practices.html)

The example gadget code includes extracting the domain of the current user.

/Rufus

On Thu, Sep 29, 2011 at 12:37 AM, Gwyn Howell <[email protected]>wrote:

> i have done something similar. if this is a gadget to work only on 1 google
> apps domain, then you can set the auth method to "Restricted to the
> following Google Apps Domain" (when creating the app engine), then on page
> load check for the user object and if it doesn't exist, to an auto redirect
> to the login url, and redirect back. for example:
>
> user = users.get_current_user()
> if user is None:
>   self.redirect(users.create_login_url(self.request.uri))
>   return
>
> this will always work (and not end up in a infinate loop), as we know the
> user is logged in as the gadget is embedded in gmail.
>
> a similar mechanism can be used using openid, but when you embed the gadget
> in gmail you will need to pass in the domain name, then  query the domain
> name from your code and perform your open id instead of the redirect
>



-- 
Andy "Rufus" Rothfusz | Developer Programs Engineer | Google | Mountain
View, CA

-- 
You received this message because you are subscribed to the Google Groups 
"Google Apps Domain Information and Management APIs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-apps-mgmt-apis?hl=en.

Reply via email to