Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)



The user package

import "appengine/user"

Introduction

Package user provides a client for App Engine's user authentication service.

Index

func Current(c appengine.Context) *User
func CurrentOAuth(c appengine.Context, scope string) (*User, error)
func IsAdmin(c appengine.Context) bool
func LoginURL(c appengine.Context, dest string) (string, error)
func LoginURLFederated(c appengine.Context, dest, identity string) (string, error)
func LogoutURL(c appengine.Context, dest string) (string, error)
func OAuthConsumerKey(c appengine.Context) (string, error)
type User
func (u *User) String() string

func Current

func Current(c appengine.Context) *User

Current returns the currently logged-in user, or nil if the user is not signed in.

func CurrentOAuth

func CurrentOAuth(c appengine.Context, scope string) (*User, error)

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 scope is non-empty and the current user does not have this scope, this method will return an error.

func IsAdmin

func IsAdmin(c appengine.Context) bool

IsAdmin returns true if the current user is signed in and is currently registered as an administrator of the application.

func LoginURL

func LoginURL(c appengine.Context, dest string) (string, error)

LoginURL returns a URL that, when visited, prompts the user to sign in, then redirects the user to the URL specified by dest.

func LoginURLFederated

func LoginURLFederated(c appengine.Context, dest, identity string) (string, error)

LoginURLFederated is like LoginURL but accepts a user's OpenID identifier.

func LogoutURL

func LogoutURL(c appengine.Context, dest string) (string, error)

LogoutURL returns a URL that, when visited, signs the user out, then redirects the user to the URL specified by dest.

func OAuthConsumerKey

func OAuthConsumerKey(c appengine.Context) (string, error)

OAuthConsumerKey returns the OAuth consumer key provided with the current request. This method will return an error if the OAuth request was invalid.

type User

type User struct {
    Email      string
    AuthDomain string
    Admin      bool

    // ID is the unique permanent ID of the user.
    // It is populated if the Email is associated
    // with a Google account, or empty otherwise.
    ID string

    FederatedIdentity string
    FederatedProvider string
}

User represents a user of the application.

func (*User) String

func (u *User) String() string

String returns a displayable name for the user.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.