I am new here and looking to contribute. Therefore, I stumbled upon the pub login command which uses oauth2 to authenticate the user and store their email & name into userInfo. But I tried with two different accounts and both resulted in a null for the name field.
Here is the response coming from userinfo_endpoint:
{
sub: 103068153864256870934,
picture: https://lh3.googleusercontent.com/a-/AOh14GgynQMyqolmPXQ87dTgmpG5PQaLk75IlNlzEf-qUA=s96-c,
email: [email protected],
email_verified: true
}
Either we can remove the name property from the UserInfo class or the API should respond with the user's name.
@sigurdm @jonasfj PTAL.
Documentation for this is somewhere under: https://developers.google.com/identity
From what I saw we don't always get the name when we lookup userinfo.
So yes, maybe it would be good if we handle the case where it's not present. And if we reference the relevant docs in a comment.
Right!
Also, the pub login command tries to display the name even if it's null.
I guess this would work:
class _UserInfo {
final String name;
final String email;
_UserInfo(this.name, this.email);
@override
String toString() => '<$email> ${name ?? ''}';
}
That looks right. Are you interested in making a PR?
Yes, I would love to do it! 馃槉