J'essaie d'obtenir le username / display name
mais je n'ai aucune idée des valeurs prises en charge. J'ai obtenu le résultat suivant email
y realname
mais je ne sais pas ce que renvoie la fonction username / display name
.
Existe-t-il une documentation ou quelque chose à ce sujet ?
Mon code actuel :
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);
}
}