OpenIdButton does not return the required parameters after authenticating

103 views
Skip to first unread message

Anup Baldawa

unread,
Jun 25, 2012, 2:22:43 PM6/25/12
to DotNetOpenAuth
Hello,

I am using the latest version of DotNetOpenAuth.

I am using OpenIDButton to authenticate and receive email address
after authentication.

<rp:OpenIdButton runat="server" ImageUrl="~/images/google.jpg"
Text="Login with Google" ID="OpenIdButton1"
Identifier="http://yahoo.com" LogOnMode="None"
OnLoggingIn="test" OnLoggedIn="OpenIdLogin1_LoggedIn">

<Extensions>
<sreg:ClaimsRequest Email="Require" />
</Extensions>

</rp:OpenIdButton>


protected void test(object sender, OpenIdEventArgs e)
{

//e.Request.AddExtension(new ClaimsRequest { Email =
DemandLevel.Require, });
}

protected void OpenIdLogin1_LoggedIn(object sender, OpenIdEventArgs e)
{
// Hide login button.
OpenIdButton1.Visible = false;

// Get email.
ClaimsResponse profile =
e.Response.GetExtension<ClaimsResponse>();
//ClaimsResponse profile =
e.Response.GetUntrustedExtension<ClaimsResponse>();

string email = profile.Email;
}

The authentication is successful but the email I receive is null.



DotNetOpenAuth version I am using is : 4.0.1.12097
The same code is working in the following version : 4.0.0.11165

Is there any difference between these two versions? Am I doing
something wrong? Instead of using <Extensions> tag, I tried to add the
email request in OnLoggingIn event with no success.

Please let me know what needs to be done?

Andrew Arnott

unread,
Jun 26, 2012, 11:32:29 PM6/26/12
to dotnet...@googlegroups.com
Your code looks right.  And a regression between v4.0.0 and v4.0.1 seems unlikely.  Is the working one on your production site and the broken one on localhost, by chance?  Yahoo! in particular is pretty picky about who they'll give data to, and that might be the issue rather than a bug in your code or DNOA.
--
Andrew Arnott
"I [may] not agree with what you have to say, but I'll defend to the death your right to say it." - S. G. Tallentyre



--
You received this message because you are subscribed to the Google Groups "DotNetOpenAuth" group.
To post to this group, send email to dotnet...@googlegroups.com.
To unsubscribe from this group, send email to dotnetopenid...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/dotnetopenid?hl=en.


Anup Baldawa

unread,
Jun 29, 2012, 4:01:35 AM6/29/12
to dotnet...@googlegroups.com
Thank you for the reply. Actually, both the version are on my local host. I tried with Google too and still the same problem. I tried with openid aspx element and still the same error. For the new version, is it different how the response is received?

I am just clueless. I might give it a try or else use the older version of dll.

Thank you for the help. Please let me know what else can I try?

Andrew Arnott

unread,
Jun 30, 2012, 2:24:21 PM6/30/12
to dotnet...@googlegroups.com
Hi Anup,

That's really peculiar.  But if there's a regression in recent versions I want to fix it.  Can you activate logging and try again with both versions.  Then include the logs from both versions in a follow-up email please?
--
You received this message because you are subscribed to the Google Groups "DotNetOpenAuth" group.
To view this discussion on the web visit https://groups.google.com/d/msg/dotnetopenid/-/3beNq1opx6oJ.

To post to this group, send email to dotnet...@googlegroups.com.
To unsubscribe from this group, send email to dotnetopenid...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/dotnetopenid?hl=en.



--

Andrew Arnott

unread,
Jun 30, 2012, 2:27:01 PM6/30/12
to dotnet...@googlegroups.com
Incidentally, I just tried the online sample (implemented here) and clicked the Login with Yahoo! button and it successfully retrieved the email address. 

Anup Baldawa

unread,
Sep 11, 2012, 2:20:58 PM9/11/12
to dotnet...@googlegroups.com
Sorry Andrew for really late reply..

I was asked to work on some other high priority stuff so couldn't get back to you on this.

I downloaded the sample and ran it and I am able to get the email. But when I do the same thing in my project, it says the response is null and it cannot get the email of the user after authentication.

I also updated my web.config file based on the web.config file from the online sample but still no luck.

This is my web.config file. Am I missing something ?

<configuration>
  <configSections>
    <!--<section name="uri" type="System.Configuration.UriSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />-->
    <!--<section name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection" requirePermission="false" allowLocation="true" />-->
    <sectionGroup name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection, DotNetOpenAuth">
      <section name="openid" type="DotNetOpenAuth.Configuration.OpenIdElement, DotNetOpenAuth" requirePermission="false" allowLocation="true"/>
      <section name="oauth" type="DotNetOpenAuth.Configuration.OAuthElement, DotNetOpenAuth" requirePermission="false" allowLocation="true"/>
      <section name="messaging" type="DotNetOpenAuth.Configuration.MessagingElement, DotNetOpenAuth" requirePermission="false" allowLocation="true"/>
      <section name="reporting" type="DotNetOpenAuth.Configuration.ReportingElement, DotNetOpenAuth" requirePermission="false" allowLocation="true"/>
    </sectionGroup>
    <section name="uri" type="System.Configuration.UriSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
  </configSections>
  <!-- The uri section is necessary to turn on .NET 3.5 support for IDN (international domain names),
       which is necessary for OpenID urls with unicode characters in the domain/host name. 
       It is also required to put the Uri class into RFC 3986 escaping mode, which OpenID and OAuth require. -->
  <uri>
    <idn enabled="All"/>
    <iriParsing enabled="true"/>
  </uri>
    <defaultProxy enabled="true"/>
    <settings>
      <!-- This setting causes .NET to check certificate revocation lists (CRL) 
           before trusting HTTPS certificates.  But this setting tends to not 
           be allowed in shared hosting environments. -->
      <!--<servicePointManager checkCertificateRevocationList="true"/>-->
    </settings>
  <!-- this is an optional configuration section where aspects of dotnetopenauth can be customized -->
  <dotNetOpenAuth>
    <openid>
      <relyingParty>
        <security requireSsl="false"/>
        <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>
    <messaging>
      <untrustedWebRequest>
        <whitelistHosts>
          <!-- since this is a sample, and will often be used with localhost -->
          <add name="localhost"/>
        </whitelistHosts>
      </untrustedWebRequest>
    </messaging>
  </dotNetOpenAuth>
  <appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <remove assembly="DotNetOpenAuth.Contracts"/>
      </assemblies>
    </compilation>
    <customErrors mode="RemoteOnly"/>
    <authentication mode="Forms">
      <forms name="OpenIdRelyingPartySession"/>
      <!-- named cookie prevents conflicts with other samples -->
    </authentication>
    <trust level="Full" originUrl=".*"/>
  </system.web>
</configuration>

Please let me know as I am not sure what is causing the problem. I also executed the code under .Net 3.5 and .Net4 platform.

On Saturday, June 30, 2012 11:27:01 AM UTC-7, Andrew Arnott wrote:
Incidentally, I just tried the online sample (implemented here) and clicked the Login with Yahoo! button and it successfully retrieved the email address. 

On Saturday, June 30, 2012, Andrew Arnott wrote:
Hi Anup,

That's really peculiar.  But if there's a regression in recent versions I want to fix it.  Can you activate logging and try again with both versions.  Then include the logs from both versions in a follow-up email please?

On Friday, June 29, 2012, Anup Baldawa wrote:
Thank you for the reply. Actually, both the version are on my local host. I tried with Google too and still the same problem. I tried with openid aspx element and still the same error. For the new version, is it different how the response is received?

I am just clueless. I might give it a try or else use the older version of dll.

Thank you for the help. Please let me know what else can I try?

--
You received this message because you are subscribed to the Google Groups "DotNetOpenAuth" group.
To view this discussion on the web visit https://groups.google.com/d/msg/dotnetopenid/-/3beNq1opx6oJ.
To post to this group, send email to dotnet...@googlegroups.com.
To unsubscribe from this group, send email to dotnetopenid+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/dotnetopenid?hl=en.



--
--
Andrew Arnott
"I [may] not agree with what you have to say, but I'll defend to the death your right to say it." - S. G. Tallentyre

Anup Baldawa

unread,
Sep 11, 2012, 6:50:42 PM9/11/12
to dotnet...@googlegroups.com
The problem is fixed.

I recreated a new project and copied the files and settings and that solved the problem.

Not sure what was wrong for it not to work.

Thank you again for all the help
Reply all
Reply to author
Forward
0 new messages