如何获得电子邮件,谷歌从OpenID提供者的性别和用户名 [英] How to get email, gender and username from Google OpenID Provider
问题描述
我一直在使用开放ID使用下面code制成登录系统
I Have made Login system using open ID Using the following code
<rp:OpenIdLogin runat="server" Identifier="https://www.google.com/accounts/o8/id" Visible="true"
ExampleUrl="" LabelText=" " RegisterText="Register" ExamplePrefix=" " ID="OpenIdLogin1"
OnLoggedIn="OpenIdTextBox1_LoggedIn" RequestEmail="Require" RequestPostalCode="Request"></rp:OpenIdLogin>
这将用户带到谷歌进行身份验证我只想sotre如电子邮件ID和他的全名和性别用户的信息我DB
It Takes the user to Google for authentication i only want to sotre the user Information like email ID and his Fullname and Sex to My DB
我写了下面的code到retirve从谷歌BU没有电子邮件retuernd
I have written the following code to retirve email from google bu nothing is retuernd
Imports System
Imports DotNetOpenAuth.OpenId.Extensions.AttributeExchange
Partial Class Food
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If (Session("FetchResponse") Is Nothing) Then
Return
End If
Dim fetchResponse As FetchResponse = CType(Session("FetchResponse"), FetchResponse)
Email = fetchResponse.GetAttributeValue(WellKnownAttributes.Contact.Email)
End Sub
Public Property Email() As String
Get
End Get
Set(ByVal value As String)
End Set
End Property
End Class
更新
我已经使用loginame的显示认证的用户名,但它显示
喜欢这个
的https://www.google.com/accounts/o8/id?id=AItOawmQoYAeHRxYW0ZOcQ5VODMPWJQgPOAYkTs
I have used loginame to display the authenticated username but it displays like this https://www.google.com/accounts/o8/id?id=AItOawmQoYAeHRxYW0ZOcQ5VODMPWJQgPOAYkTs
我怎么能显示实际电子邮件或用户名
how can i display actual email or username
推荐答案
看到重复的问题<一href=\"http://stackoverflow.com/questions/8599252/how-to-get-email-from-google-openid-provider-in-vb\">How摆脱谷歌的OpenID提供商(在VB)电子邮件的答案,与补遗是:
See duplicate question How to get email from Google OpenID Provider (in VB) for the answer, with the addendum that:
您不能得到谷歌用户的用户名的或性别。你可以得到他们的电子邮件地址,我想这就是它。 (也许他们的全名以及)。这是最高个人OpenID提供和谷歌,像其他路数,先后当选为提供用户最少的数据。
You cannot get the Google user's username or gender. You can get their email address and I think that's about it. (Maybe their full name as well). This is up to individual OpenID Providers and Google, like other large ones, has elected to provide minimal data on the user.
这篇关于如何获得电子邮件,谷歌从OpenID提供者的性别和用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!