OpenID on Google not returning anything
-
27-09-2019 - |
Question
For some reason, the following code does not return anything:
string alias = response.FriendlyIdentifierForDisplay;
var sreg = response.GetExtension<ClaimsResponse>();
if (sreg != null && sreg.MailAddress != null)
{
alias = sreg.MailAddress.User;
}
if (sreg != null && !string.IsNullOrEmpty(sreg.Email))
{
alias = sreg.Email;
}
if (sreg != null && !string.IsNullOrEmpty(sreg.FullName))
{
alias = sreg.FullName;
}
I was hoping I can get the Email from Yahoo or Google, but sreg just return null whichever provider I have chosen.
I saw some of other posts that this code should return an e-mail at least, but for me, it does not, please assist.
Thanks alot
Solution
You must ensure that what you add the email address to ClaimsRequest with the required flag set to true.
You must also ensure that you've correctly activated the AXFetchAsSregTransform.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow