开发者

Facebook iFrame application - Get current userId before accepting permission

开发者 https://www.devze.com 2023-02-16 09:03 出处:网络
I\'m just wondering if it would 开发者_JAVA技巧be possible to get the id of the current user using javascript framework or something similar without them accepting permissions?

I'm just wondering if it would 开发者_JAVA技巧be possible to get the id of the current user using javascript framework or something similar without them accepting permissions?

I'm using the facebooksdk for .net, I know I would be unable to get the id using the .net sdk but not sure how to do it using JavaScript any help would be appreciated.


If you mean by "accepting permission" authorizing your application then NO, Facebook will not share the User ID before authorizing the application!


One thing you can do is check if they have accepted permissions for your app before. That way you know if you can get their Id with this code (i'm using 5.0.3)

public FacebookSession CurrentSession
    {
        get { return (new CanvasAuthorizer()).Session; }
    }

    [CanvasAuthorize(Permissions = "user_about_me")]
    public bool UserHasApp()
    {
        if (CurrentSession == null)
            return false;
        else
            return true;

    }

If they have you app then you can get the id. Look at the SDK example projects for how they get info from the user.

0

精彩评论

暂无评论...
验证码 换一张
取 消