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-07 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 holds information about the authenticated user, such as their email, authentication domain, ID, and more, including if they are an admin.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eCurrent\u003c/code\u003e and \u003ccode\u003eCurrentOAuth\u003c/code\u003e functions allow retrieving information about the currently logged-in user, with the latter handling OAuth-based authentication and scope validation.\u003c/p\u003e\n"],["\u003cp\u003eUsers can view the \u003ccode\u003euser\u003c/code\u003e package on pkg.go.dev to gain more information and see older versions.\u003c/p\u003e\n"]]],[],null,["# Package google.golang.org/appengine/v2/user (v2.0.6)\n\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/v2/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_v2_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_v2_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_v2_user_User) String() https://pkg.go.dev/builtin#string\n\nString returns a displayable name for the user."]]