我使用Play-Authenticate来允许用户使用Google帐户登录。登录工作正常。现在,我想显示已登录用户的个人资料图片。
我看到在提供者中有一个‘图片’字段。com.feth.play.module.pa.providers.oauth2.google.GoogleAuthUser
如何在控制器中访问此字段,以便在视图中显示图片?
发布于 2015-04-20 16:41:34
您需要像GoogleAuthUser一样使用instanceof来检查AuthUser是否实现了com.feth.play.module.pa.user.PicturedIdentity。然后,您可以将AuthUser转换为PicturedIdentity并对其调用getPicture()。
https://stackoverflow.com/questions/29650648
复制相似问题