Stay organized with collections
Save and categorize content based on your preferences.
Provides facilities to check if a user has authenticated, retrieve their email address, and check
if they are an administrator for this application. It can also be used to construct a URL for
users to login or logout.
As an example, your application might, in a JSP file, have code like this:
User represents a specific user, represented by the
combination of an email address and a specific Google Apps domain
(which we call an authDomain). For normal Google login,
authDomain will be set to "gmail.com".
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eUserService\u003c/code\u003e allows applications to verify user authentication status, fetch user email addresses, and determine if a user has administrator privileges.\u003c/p\u003e\n"],["\u003cp\u003eIt provides the functionality to create URLs for users to log in or log out of the application.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eUser\u003c/code\u003e class represents an individual user, identified by their email address and Google Apps domain, which is typically "gmail.com" for regular Google logins.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eUserServiceFactory\u003c/code\u003e enables the creation of a \u003ccode\u003eUserService\u003c/code\u003e instance.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eUserServiceFailureException\u003c/code\u003e is an exception that can be triggered if there are issues communicating with the user service.\u003c/p\u003e\n"]]],[],null,["# Package com.google.appengine.api.users (2.0.0)\n\nProvides facilities to check if a user has authenticated, retrieve their email address, and check\nif they are an administrator for this application. It can also be used to construct a URL for\nusers to login or logout.\n\nAs an example, your application might, in a JSP file, have code like this: \n\n\n \u003c%\n UserService userService = UserServiceFactory.getUserService();\n if (!userService.isUserLoggedIn()) {\n %\u003e\n Please {@code \u003c%=userService.createLoginURL(\u003e}\n \u003c% } else { %\u003e\n Welcome, \u003c%= userService.getCurrentUser().getNickname(); %\u003e!\n {@code (\u003c%=userservice.createlogouturl(\u003c%=userservice.createlogouturl(\u003e)}\n \u003c%\n }\n %\u003e\u003e\n\nSee Also: [com.google.appengine.api.users.UserService](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.users.UserService), [The Users Java API in the *Google App Engine Developer's Guide*](http://cloud.google.com/appengine/docs/java/users/).\n\nClasses\n-------\n\n### [IUserServiceFactoryProvider](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.users.IUserServiceFactoryProvider)\n\nCreates `IUserServiceFactory` implementations.\n\n**Note:** This class is not intended for end users.\n\n### [User](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.users.User)\n\n`User` represents a specific user, represented by the\ncombination of an email address and a specific Google Apps domain\n(which we call an `authDomain`). For normal Google login,\n`authDomain` will be set to \"gmail.com\".\n\n### [UserServiceFactory](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.users.UserServiceFactory)\n\nCreates a UserService.\n\nInterfaces\n----------\n\n### [IUserServiceFactory](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.users.IUserServiceFactory)\n\nThis interface should be implemented by providers of the [UserService](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.users.UserService) and registered with\n[com.google.appengine.spi.ServiceFactoryFactory](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.spi.ServiceFactoryFactory).\n\n### [UserService](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.users.UserService)\n\nThe UserService provides information useful for forcing a user to\nlog in or out, and retrieving information about the user who is\ncurrently logged-in.\n\nExceptions\n----------\n\n### [UserServiceFailureException](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.users.UserServiceFailureException)\n\n`UserServiceFailureException` is thrown when any unknown\nerror occurs while communicating with the user service."]]