I am trying to get the username / display name
, but I have no idea what are the supported values. I got the email
and realname
, but I don't know what returns the username / display name
.
Is there a documentation or something about this?
My current code:
public class StackExchangeOpenID : OpenIdClient
{
public StackExchangeOpenID()
: base("stackexchange", "https://openid.stackexchange.com")
{
}
protected override Dictionary<string, string> GetExtraData(IAuthenticationResponse response)
{
FetchResponse fetchResponse = response.GetExtension<FetchResponse>();
if (fetchResponse != null)
{
var extraData = new Dictionary<string, string>();
extraData.Add("email", fetchResponse.GetAttributeValue(WellKnownAttributes.Contact.Email));
extraData.Add("name", fetchResponse.GetAttributeValue(WellKnownAttributes.Name.FullName));
// returned value: null
//extraData.Add("username", fetchResponse.GetAttributeValue(WellKnownAttributes.Name.Alias));
return extraData;
}
return null;
}
protected override void OnBeforeSendingAuthenticationRequest(IAuthenticationRequest request)
{
var fetchRequest = new FetchRequest();
fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.Email);
fetchRequest.Attributes.AddRequired(WellKnownAttributes.Name.FullName);
// returned value: null
//fetchRequest.Attributes.AddRequired(WellKnownAttributes.Name.Alias);
request.AddExtension(fetchRequest);
}
}
What's your arrow is pointing to their isn't a display name (StackID has no notion of display names, your login is your email address) but an optional "Vanity Id".
For example:
Gives me the vanity OpenID of https://openid.stackexchange.com/kevin.montrose . This is just an easier to remember alias for relying parties that require manual entry of OpenID urls.
Email and Real Name/Full Name are the only attributes StackID supports querying for, and will return both via either SREG or AX extensions (as seen in the code).