I'm implementing OpenID and I would like to retrieve the user's email address and other information about the user, I'm doing this:
var fetch = new FetchRequest();
fetch.AddAttribute(new AttributeRequest(WellKnownAttributes.Contact.Email));
request.AddExtension(fetch);
But the provider doesn't return anything. I'm using DotNetOpenID
What am I doing wrong?
thanks!
EDIT:
When I try to signup at http://www.plaxo.com/ using MyOpenID or Google, they both say plaxo is requesting additional information, but when I test my site they doesn't say anything...
In the Azure portal for the AD tenant you are configured against. If you go to App registrations, select the App name you want to configure and then select Token configuration. You can add an optional parameter of email. This requires OpenID connect scopes to also be configures.
Google's OAuth 2.0 APIs can be used for both authentication and authorization. This document describes our OAuth 2.0 implementation for authentication, which conforms to the OpenID Connect specification, and is OpenID Certified.
As Martin said, it depends on the Provider.
MyOpenID doesn't do AttributeExchange, I think. They do sreg (Simple Registration) though, so add a ClaimsRequest
extension to your request and you'll get a ClaimsResponse
back from some Providers.
Google only does AttributeExchange, and only provides an email address. The only thing you're missing from your code is that Google also doesn't even volunteer the email address unless you mark it as "Required" in your request. Add a ", true" second parameter to the AttributeRequest constructor and then Google should light up and give you the users' email address.
Here are some docs and samples of getting attributes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With