这在 Java 中对我有用:
Set<String> attributesRequest = new HashSet<String>();
String loginRealm = "http://myapp.appspot.com"; //Important that it is exactly the same as in application-manifest.xml, watch out for trailing slashes.
String destinationURL = req.getRequestURI() + "?" + req.getQueryString();
String federatedIdentity = null;
String authDomain = req.getParameter("hd"); //hd is the default parameter name. Contains the google apps domain name of the user logging on. example.com for example.
String loginUrl = userService.createLoginURL(destinationURL, federatedIdentity, authDomain, attributesRequest);
确保包括
<Edition id="free">
<Name>Cloud App Studio</Name>
<Extension ref="navLink" />
<Extension ref="realm" />
</Edition>
在应用程序清单.xml 中。也就是说,如果它是免费的。重要的部分是包含对领域的引用。