PHP 5 has reached end of support and will be
deprecated
on January 31, 2026. After deprecation, you won't be able to deploy PHP 5
applications, even if your organization previously used an organization policy to
re-enable deployments of legacy runtimes. Your existing PHP
5 applications will continue to run and receive traffic after their
deprecation date. We recommend that
you
migrate to the latest supported version of PHP.
\google\appengine\api\users\UserService
Stay organized with collections
Save and categorize content based on your preferences.
FINAL
Methods
createLoginURL
STATIC
createLoginURL(string $destination_url = null, string $federated_identity = null) : string
Computes the login URL for redirection.
Parameters
Name |
Description |
$destination_url
|
string
The desired final destination URL for the
user once login is complete. If 'destinationURL' does not
have a host specified, we will use the host from the
current request. |
$federated_identity
|
string
The parameter is used to trigger OpenId
Login flow, an empty value will trigger Google OpenID Login
by default. |
Throws
\google\appengine\api\users\UsersException
If there was a problem using the Users service.
Returns
string
Login URL. If federatedIdentity is set, this will be
a federated login using the specified identity. If not, this
will use Google Accounts.
createLogoutURL
STATIC
createLogoutURL(string $destination_url) : string
Computes the logout URL for this request and specified destination URL,
for both federated login App and Google Accounts App.
Parameters
Name |
Description |
$destination_url
|
string
The desired final destination
URL for the user once logout is complete.
If 'destinationURL' does not have a host specified, we will
use the host from the current request. |
Throws
\google\appengine\api\users\UsersException
If there was a problem using the Users service.
Returns
string
Logout URL.
getCurrentUser
STATIC
getCurrentUser() : \google\appengine\api\users\User
Get the current logged in user.
Returns
\google\appengine\api\users\User
The object representing the current signed in user, or null
if no user is signed in.
isCurrentUserAdmin
STATIC
isCurrentUserAdmin() : boolean
Return true if the user making this request is an admin for this
application, false otherwise.
We specifically make this a separate function, and not a member function
of the User class, because admin status is not persisted in the
datastore. It only exists for the user making this request right now.
Returns
boolean
Whether the current user is an administrator of the
application.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-06-16 UTC.
[[["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-06-16 UTC."],[[["\u003cp\u003e\u003ccode\u003ecreateLoginURL\u003c/code\u003e generates a login URL, redirecting users to a specified destination after login, supporting both Google Accounts and federated identity logins.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ecreateLogoutURL\u003c/code\u003e creates a logout URL that directs users to a designated URL after they log out, handling both federated and Google Accounts.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetCurrentUser\u003c/code\u003e retrieves the currently logged-in user, returning a \u003ccode\u003eUser\u003c/code\u003e object or null if no user is logged in.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eisCurrentUserAdmin\u003c/code\u003e checks if the user making the request is an administrator for the application, providing a boolean result based on their admin status.\u003c/p\u003e\n"]]],[],null,["# \\google\\appengine\\api\\users\\UserService\n\nFINAL\n\nMethods\n-------\n\n### createLoginURL\n\n\nSTATIC\n\n`createLoginURL(string `$destination_url = null`, string `$federated_identity = null`) : string`\n\nComputes the login URL for redirection.\n\n#### Parameters\n\n#### Throws\n\n`\\google\\appengine\\api\\users\\UsersException`\n\nIf there was a problem using the Users service.\n\n#### Returns\n\n`string`\n\nLogin URL. If federatedIdentity is set, this will be\na federated login using the specified identity. If not, this\nwill use Google Accounts.\n\n### createLogoutURL\n\n\nSTATIC\n\n`createLogoutURL(string `$destination_url`) : string`\n\nComputes the logout URL for this request and specified destination URL,\nfor both federated login App and Google Accounts App.\n\n#### Parameters\n\n#### Throws\n\n`\\google\\appengine\\api\\users\\UsersException`\n\nIf there was a problem using the Users service.\n\n#### Returns\n\n`string`\n\nLogout URL.\n\n### getCurrentUser\n\n\nSTATIC\n\n`getCurrentUser() : \\google\\appengine\\api\\users\\User`\n\nGet the current logged in user.\n\n#### Returns\n\n[\\google\\appengine\\api\\users\\User](../classes/google.appengine.api.users.User.html)\n\nThe object representing the current signed in user, or null\nif no user is signed in.\n\n### isCurrentUserAdmin\n\n\nSTATIC\n\n`isCurrentUserAdmin() : boolean`\n\nReturn true if the user making this request is an admin for this\napplication, false otherwise.\n\nWe specifically make this a separate function, and not a member function\nof the User class, because admin status is not persisted in the\ndatastore. It only exists for the user making this request right now.\n\n#### Returns\n\n`boolean`\n\nWhether the current user is an administrator of the\napplication."]]