Unity中的Facebook Graph Api不授予电子邮件权限 [英] Facebook Graph Api in Unity not granting email permission

查看:138
本文介绍了Unity中的Facebook Graph Api不授予电子邮件权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在努力为Unity的Facebook API缠住头,我认为我已经开始了解它了……直到

So i'm trying to wrap my head around the Facebook API for Unity, and I think i'm starting to get the hang of it...until this

FB.Login ("public_profile, user_photos, email", AuthCallBack);

如您所见,我显然要求获得电子邮件许可,但是当我尝试在Unity中调用它时

so as you can see I obviously ask for the email permission, yet when I try to call it in Unity

Dictionary<string, string> emailDict = new Dictionary<string, string>(){{"email", ""}};

        FB.API( "me?fields=email", Facebook.HttpMethod.GET, FBGetEmail, emailDict);

        print ("emailDict " + emailDict.Keys);

这只会产生我的用户名.我使用从应用程序中获得的新生成的访问令牌对Graph Explorer进行了进一步的挖掘,该令牌显示了以下内容

This only yields me my userid. I did some further digging into the Graph Explorer with the same newly generated access token which I got from the app which revealed the following

The field 'email' is only accessible on the User object after the user grants the 'email' permission.

{"id": "952814180948",}

所以我的问题是...有人知道//有人可以看到我在做什么吗?由于问题显然出在访问令牌生成时的初始请求中.我知道权限正在起作用,因为我能够拉出并使用我的个人资料照片.只是不发送电子邮件:'(

so my question is... does anyone know//can anyone see what i'm doing wrong to not be able to get the email permission? Since the problem is obviously in the initial request when when the access token is generated. I know the permissions are working as I'm able to pull and use my profile pic..just not the email :'(

推荐答案

所以我想通了!!!答案位于facebook文档的一行中.基本上,在Unity的编辑器模式下使用身份验证令牌时,它允许您获取令牌",但是此生成的令牌仅具有一些默认权限.

So I figured it out!!! The answer is nestled in a single line in the facebook docs. Basically, when using the authentication tokens in Unity's editor mode, It allows you go "get token" But this generated token has just some default permissions.

您实际上需要转到图形浏览器,并在顶部将您的应用设置为您的APP(尚不清楚,我认为这使您进入应用页面不会为您的应用生成访问令牌).

You need to actually go to the graph explorer, and at the top set your app to YOUR APP ( it wasnt clear, I thought that it made you go to your app page NOT generate access tokens for your app).

一旦这样做,我便可以通过使用图形浏览器页面上的获取访问令牌"按钮来生成具有所需权限的新访问令牌.

Once I did that, I was able to generate new access tokens with the permissions I wanted by using the Get Access Token Button on the graph explorer page.

鱼!整整两天只是为了弄清楚这一点.

Oish! Two whole days just to figure that out.

这篇关于Unity中的Facebook Graph Api不授予电子邮件权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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