Facebook电子邮件字段返回null(即使设置并接受“电子邮件”权限)第二部分 [英] Facebook Email field return null (even if the “email” permission is set and accepted) part 2

查看:129
本文介绍了Facebook电子邮件字段返回null(即使设置并接受“电子邮件”权限)第二部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是链接描述了我的初始问题的主题。

Here's a link to the topic which described my initial problem.

简而言之:问题是在某些情况下,facebook-graph-api不会返回用户的电子邮件地址。

In short: the problem is that in some cases facebook-graph-api doesn't return the email address of the user.

如果他有一个我所做的用户名(即userName@facebook.com),建议使用他的Facebook电子邮件。但是如果Facebook用户也没有用户名,该怎么办?

Other stackoverflow mates suggested to use his Facebook email if he has a user name (i.e. userName@facebook.com) which I've done. But what to do if the facebook user doesn't have "username" there too.

你会推荐什么?要重定向他的页面,询问他的电子邮件地址?

What would you recommend? To redirect him on the page asking his email address?

推荐答案

Facebook API没有返回电子邮件地址有几个原因。某些原因列在 https://developers.facebook.com/bugs/298946933534016

There are several reasons why Facebook API doesn't return the email address. Some reasons are listed in https://developers.facebook.com/bugs/298946933534016

提出了不同的解决方案来处理这种情况,例如在 https://github.com/mkdynamic/omniauth-facebook/issues/61

Different solutions were proposed to handle this case like in a discussion at https://github.com/mkdynamic/omniauth-facebook/issues/61

但我认为使用 userName@facebook.com 不是一个很好的解决方案,因为它不是一个有效的电子邮件,而 userName 可能也不可用,您将尝试向用户发送电子邮件,它将无法传送等。

But I think using userName@facebook.com is not a good solution, because it's not a valid email, and userName might be not available either, and when you will try sending an email to the user, it will fail to deliver, etc.

请求用户的电子邮件地址也不是件好事,因为有些用户可能拒绝提供电子邮件。

Asking a user's email address also is not a good thing to do, since some users might refuse to provide their emails.

我建议像 uid@facebook.yourdomain.com 其中 uid 是始终返回fr的用户ID om Facebook和您的域名的子域,您可以处理像您想要的这样的假电子邮件。

I recommend constructing such a fake mail like uid@facebook.yourdomain.com where uid is a user ID guaranteed always to return from Facebook, and a subdomain of your domain where you can handle such fake emails like you want.

这篇关于Facebook电子邮件字段返回null(即使设置并接受“电子邮件”权限)第二部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆