Go 1.11 has reached end of support
and will be deprecated
on January 31, 2026. After deprecation, you won't be able to deploy Go 1.11
applications, even if your organization previously used an organization policy to
re-enable deployments of legacy runtimes. Your existing Go
1.11 applications will continue to run and receive traffic after their
deprecation date. We
recommend that you migrate to the latest supported version of Go.
OAuthConsumerKey returns the OAuth consumer key provided with the current
request. This method will return an error if the OAuth request was invalid.
User
typeUserstruct{EmailstringAuthDomainstringAdminbool// ID is the unique permanent ID of the user.// It is populated if the Email is associated// with a Google account, or empty otherwise.IDstring// ClientID is the ID of the pre-registered client so its identity can be verified.// See https://developers.google.com/console/help/#generatingoauth2 for more information.ClientIDstringFederatedIdentitystringFederatedProviderstring}
CurrentOAuth returns the user associated with the OAuth consumer making this
request. If the OAuth consumer did not make a valid OAuth request, or the
scopes is non-empty and the current user does not have at least one of the
scopes, this method will return an error.
[[["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-08-28 UTC."],[[["\u003cp\u003eThe \u003ccode\u003euser\u003c/code\u003e package provides functionality for managing user authentication within App Engine applications.\u003c/p\u003e\n"],["\u003cp\u003eIt includes functions to check if a user is an administrator (\u003ccode\u003eIsAdmin\u003c/code\u003e), generate login and logout URLs (\u003ccode\u003eLoginURL\u003c/code\u003e, \u003ccode\u003eLoginURLFederated\u003c/code\u003e, \u003ccode\u003eLogoutURL\u003c/code\u003e), and retrieve the OAuth consumer key (\u003ccode\u003eOAuthConsumerKey\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eThe package defines a \u003ccode\u003eUser\u003c/code\u003e struct that represents an application user and includes fields like Email, AuthDomain, ID, ClientID, FederatedIdentity and FederatedProvider.\u003c/p\u003e\n"],["\u003cp\u003eFunctions \u003ccode\u003eCurrent\u003c/code\u003e and \u003ccode\u003eCurrentOAuth\u003c/code\u003e allow retrieval of the currently logged-in user, with \u003ccode\u003eCurrentOAuth\u003c/code\u003e specifically for users associated with OAuth consumers.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of this package is 1.6.8, however previous versions are also available such as 1.6.7.\u003c/p\u003e\n"]]],[],null,["# Package google.golang.org/appengine/user (v1.6.8)\n\nVersion latestkeyboard_arrow_down\n\n- [1.6.8 (latest)](/appengine/docs/legacy/standard/go111/reference/latest/user)\n- [1.6.7](/appengine/docs/legacy/standard/go111/reference/1.6.7/user) \n**Note:** To get more information about this package, such as access to older versions, view [this package on pkg.go.dev](https://pkg.go.dev/google.golang.org/appengine/user). \n\u003cbr /\u003e\n\nPackage user provides a client for App Engine's user authentication service. \n\nFunctions\n---------\n\n### func IsAdmin\n\n func IsAdmin(c https://pkg.go.dev/context.https://pkg.go.dev/context#Context) https://pkg.go.dev/builtin#bool\n\nIsAdmin returns true if the current user is signed in and\nis currently registered as an administrator of the application. \n\n### func LoginURL\n\n func LoginURL(c https://pkg.go.dev/context.https://pkg.go.dev/context#Context, dest https://pkg.go.dev/builtin#string) (https://pkg.go.dev/builtin#string, https://pkg.go.dev/builtin#error)\n\nLoginURL returns a URL that, when visited, prompts the user to sign in,\nthen redirects the user to the URL specified by dest. \n\n### func LoginURLFederated\n\n func LoginURLFederated(c https://pkg.go.dev/context.https://pkg.go.dev/context#Context, dest, identity https://pkg.go.dev/builtin#string) (https://pkg.go.dev/builtin#string, https://pkg.go.dev/builtin#error)\n\nLoginURLFederated is like LoginURL but accepts a user's OpenID identifier. \n\n### func LogoutURL\n\n func LogoutURL(c https://pkg.go.dev/context.https://pkg.go.dev/context#Context, dest https://pkg.go.dev/builtin#string) (https://pkg.go.dev/builtin#string, https://pkg.go.dev/builtin#error)\n\nLogoutURL returns a URL that, when visited, signs the user out,\nthen redirects the user to the URL specified by dest. \n\n### func OAuthConsumerKey\n\n func OAuthConsumerKey(c https://pkg.go.dev/context.https://pkg.go.dev/context#Context) (https://pkg.go.dev/builtin#string, https://pkg.go.dev/builtin#error)\n\nOAuthConsumerKey returns the OAuth consumer key provided with the current\nrequest. This method will return an error if the OAuth request was invalid. \n\nUser\n----\n\n type User struct {\n \tEmail https://pkg.go.dev/builtin#string\n \tAuthDomain https://pkg.go.dev/builtin#string\n \tAdmin https://pkg.go.dev/builtin#bool\n\n \t// ID is the unique permanent ID of the user.\n \t// It is populated if the Email is associated\n \t// with a Google account, or empty otherwise.\n \tID https://pkg.go.dev/builtin#string\n\n \t// ClientID is the ID of the pre-registered client so its identity can be verified.\n \t// See https://developers.google.com/console/help/#generatingoauth2 for more information.\n \tClientID https://pkg.go.dev/builtin#string\n\n \tFederatedIdentity https://pkg.go.dev/builtin#string\n \tFederatedProvider https://pkg.go.dev/builtin#string\n }\n\nUser represents a user of the application. \n\n### func Current\n\n func Current(c https://pkg.go.dev/context.https://pkg.go.dev/context#Context) *#google_golang_org_appengine_user_User\n\nCurrent returns the currently logged-in user,\nor nil if the user is not signed in. \n\n### func CurrentOAuth\n\n func CurrentOAuth(c https://pkg.go.dev/context.https://pkg.go.dev/context#Context, scopes https://pkg.go.dev/builtin#string) (*#google_golang_org_appengine_user_User, https://pkg.go.dev/builtin#error)\n\nCurrentOAuth returns the user associated with the OAuth consumer making this\nrequest. If the OAuth consumer did not make a valid OAuth request, or the\nscopes is non-empty and the current user does not have at least one of the\nscopes, this method will return an error. \n\n### func (\\*User) String\n\n func (u *#google_golang_org_appengine_user_User) String() https://pkg.go.dev/builtin#string\n\nString returns a displayable name for the user."]]