Lightopenid and yahoo user email
-
21-02-2021 - |
Question
What's the current state of Yahoo's openid support? No matter how I tried, it only gives back the nameperson attribute, but I can't get the user's email (contact/email). Is there any way to get the email with the lightopenid library?
Solution
Exactly the way you tried -- by adding 'contact/email'
to $openid->required
(or optional
).
If a provider doesn't return the email -- that's fine, it doesn't have to. It doesn't mean that the provider doesn't support OpenID, or doesn't support SREG/AX (the OpenID extensions used to fetch the email). It just means that it decided not to send you the email address.
So my advice is: stop depending on that.
OpenID is a decentralized protocol, so there are a lot of providers that won't return email and other data, and you still have to support them. So again: the provider may return whatever data it wants, regardless of what you asked for, so you can't depend on it being returned.