블로그 게시물의 여러 힌트 How to pretty much guarantee that you might get an email address with OpenID.
<configuration>
<configSections>
<section name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection" requirePermission="false" allowLocation="true"/>
</configSections>
<dotNetOpenAuth>
<openid>
<relyingParty>
<behaviors>
<!-- The following OPTIONAL behavior allows RPs to use SREG only, but be compatible
with OPs that use Attribute Exchange (in various formats). -->
<add type="DotNetOpenAuth.OpenId.Behaviors.AXFetchAsSregTransform, DotNetOpenAuth" />
</behaviors>
</relyingParty>
</openid>
</dotNetOpenAuth>
</configuration>
을 그리고 당신은 당신이 사용자의 이메일 주소를 필요로하는 공급자를 알려줄 필요가 : 한마디로
, 당신은 activate the AXFetchAsSregTransform behavior해야합니다. 이상적으로이 같이 할 것입니다 :
<rp:OpenIdButton runat="server"
Text="Log in with Google"
Identifier="https://www.google.com/accounts/o8/id">
<Extensions>
<sreg:ClaimsRequest Email="Require" />
</Extensions>
</rp:OpenIdButton>
그러나 OpenIdButton
작업에서 <Extensions>
태그를 유지 DotNetOpenAuth 버그 (v3.4.7 수정이)가있다. 따라서 대신 코드 숨김에 속성 요청을 추가해야합니다. 그래서 태그 보이는 같은 :
<rp:OpenIdButton runat="server"
Text="Log in with Google"
OnLoggingIn="OpenId_LoggingIn"
Identifier="https://www.google.com/accounts/o8/id" />
그리고 당신의 코드 숨김이 방법이 있습니다
protected void OpenId_LoggingIn(object sender, OpenIdEventArgs e) {
e.Request.AddExtension(new ClaimsRequest() { Email = DemandLevel.Require });
}
감사 앤드류 노츠를. btw 도서관은 위대하다 :) – Ranger
매우 유익한. – pqsk
안녕하세요, "AXFetchAsSregTransform 동작 활성화 :"링크가 죽은 것 같습니다. GitHub에서 404를 얻으십시오. 이 정보가 옮겨 졌습니까? 그렇다면 어디에서? 나는 그것을 다시 읽고 싶다. –