I've been using DoNetOpenAuth library and followed the example here
The authentication is working, but even though I require an email, the claimsresponse is null. In fact, it doesn't matter what I require, claimsresponse is always null. Not sure what I'm doing wrong and I'd appreciate your help.
Thanks in advance.
Here is my login button code
protected void btnSubmit_Click( object sender, EventArgs e )
{
//Login button has been pushed. Add an extension and redirect
using (OpenIdRelyingParty openId = new OpenIdRelyingParty())
{
IAuthenticationRequest request = openId.CreateRequest( txtOpenID.Text );
request.AddExtension( new ClaimsRequest
{
Email = DemandLevel.Require,
Country = DemandLevel.Request,
TimeZone = DemandLevel.Request
} );
request.RedirectToProvider();
}
}
Here is the page load code. ClaimsResponse variable is always null though.
protected void Page_Load( object sender, EventArgs e )
{
OpenIdRelyingParty openId = new OpenIdRelyingParty();
var response = openId.GetResponse();
//check if we're processing a request
if(response != null)
{
switch ( response.Status )
{
case AuthenticationStatus.Authenticated:
//authentication worked. grab our required fields
var claimsResponse = response.GetExtension<ClaimsResponse>();
//TODO enter required fields into the database
break;
case AuthenticationStatus.Canceled:
//TODO handle cancel
break;
case AuthenticationStatus.Failed:
//TODO handle failed
break;
}
}
}