dongyi1111 2015-01-18 15:10
浏览 18

在GAE中,什么时候用户可能没有ID

I am building a web app with go and GAE. I would like to use Google Accounts for authentication. The appengine/user package contains a type, User. I was planning on using ID property of User as the ancestor to descendent entities in the Datastore. However I'm confused by the comments in this section of documentation:

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
}

Source: https://cloud.google.com/appengine/docs/go/users/reference#User

Under what circumstances might an email not be associated with a google account and therefore ID be empty?

I'm very new to go and GAE so please excuse my ignorance.

  • 写回答

1条回答 默认 最新

  • duanchifo2866 2015-03-29 01:03
    关注

    There are several key differences between email and id. E.g. "The app can also access a user ID that identifies the user uniquely, even if the user changes the email address for her account." Also "Every user has the same user ID for all App Engine applications."

    Like ThunderCat said, if you use a Federated Login (OpenID was the only one supported, but is no longer), then you will not get a user id.

    See the docs for more info.

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题