Facebook Unity SDK, how to force login using webvi

2019-07-21 05:29发布

问题:

By default, the FB Unity SDK will try to use the FB App to login if the user has it installed. Otherwise, it will fall back to using a HTML based popup to let the user login.

However the FB App only works with API 1.0 ("basic_info" permission). Will fail with "Invalid permissions" on "public_profile".

The webview dialog only works with API 2.0 ("public_profile" permission). Will fail with "Invalid Scope: basic_info. Use public_profile".

The best fix would be to force the sdk to ignore the FB App and use webview to login all the time. Can this be done in Android?

回答1:

Yes, try this

 openRequest.setLoginBehavior(SessionLoginBehavior.SUPPRESS_SSO);

Or, if you use old fb sdk

authorize(activity, permissions, FORCE_DIALOG_AUTH, listener);


回答2:

In the latest SDK use FB.Mobile.ShareDialogMode to set the default behavior to webview.