获取当前用户的UserId的最佳方法是什么 [英] What is the best way to get the UserId of the current user

查看:118
本文介绍了获取当前用户的UserId的最佳方法是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取Face Book当前用户ID.我想避免请求权限,因为我的用户只是在浏览,我只想看看他们以前是否做过此事.

How to get Face Book Current UserId . I would like to avoid asking for permissions since my users are just browsing and i only want to see if they have done this before.

推荐答案

使用Facebook c#sdk:

using Facebook c# sdk:

 string signedRequest = Request.Form["signed_request"];
     var DecodedSignedRequest = FacebookSignedRequest.Parse(Facebook.Web.FacebookWebContext.Current.Settings.AppSecret, signedRequest);
                    dynamic SignedRequestData = DecodedSignedRequest.Data;
         accessToken = (String)SignedRequestData.oauth_token;
                        var app = new FacebookWebClient();
                        var me = (IDictionary<string, object>)app.Get("me");
                        firstName = (string)me["name"];
                        U_Id = (string)me["id"];

这篇关于获取当前用户的UserId的最佳方法是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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