Logging in with Facebook SDK from the Web Player

I’m trying the Examples/InteractiveConsole scene that comes with the Facebook Unity SDK (Version 131121) on Unity version 4.3.2f1. My goal is to figure out how to invoke a facebook login from the web build and retrieve the access_token.

When running it in the editor, upon hitting FB.Init, FB.isLoggedIn becomes true automatically, even before I’ve logged in (in fact, even without entering the App ID from the app I created on Facebook in the “Facebook->Edit Settings” inspector) and trying to run FB.Login just get the message “User is already logged in. You don’t need to call this again”. The UserID and Access Token are all blank.

I then tried building it for the Web (and after having to fix the url of the canvas app DLL to get it to download), hitting FB.Init update the message at the top to “Status: FB.Init() called with 123456781234567”, but doesn’t get any further. UserID and Access Token are once again blank.

Know what I need to do? The web player console log looks unremarkable:

`


140204 23:30:46 ------------------------------------------------------------
140204 23:30:46 Instance starting, version 4.3.2f1_0517a5ae8669, UNITY_WEB_ENABLE_AUTODOWNLOAD: 1, GetDisableAutoUpdates(): 0
140204 23:30:46 Datafile file:///C:/Users/Robert/Documents/FacebookTest/web/web.unity3d
web: player version 4.3.4f1
web: load mono
Mono path[0] = ‘C:/Users/Robert/AppData/LocalLow/Unity/WebPlayer/player/Release3.x.x/Data/lib’
Mono path[1] = ‘C:/Users/Robert/AppData/LocalLow/Unity/WebPlayer/mono/Release3.x.x/Data/lib’
Mono config path = ‘C:/Users/Robert/AppData/LocalLow/Unity/WebPlayer/mono/Release3.x.x/Data/etc’
web: start, src=web.unity3d abs=file:///C:/Users/Robert/Documents/FacebookTest/web/web.unity3d flags=0x0
web: sucessfully initialized
140204 23:30:47 loader: start ok
140204 23:30:47 Times: download 0.1 load 1.2
Loading webdata version: 4.3.2f1
Initialize engine version: 4.3.4f1 (e444f76e01cd)
GfxDevice: creating device client; threaded=0
Direct3D:
Version: Direct3D 9.0c [igdumdim32.dll 10.18.10.3277]
Renderer: Intel(R) HD Graphics 4600
Vendor: Intel
VRAM: 1792 MB (via DXGI)
Caps: Shader=30 DepthRT=1 NativeDepth=1 NativeShadow=1 DF16=1 INTZ=1 RAWZ=0 NULL=1 RESZ=1 SlowINTZ=0
Begin MonoManager ReloadAssembly
Platform assembly: C:\Users\Robert\AppData\LocalLow\Unity\WebPlayer\player\Release3.x.x\Data\lib\UnityEngine.dll (this message is harmless)
Non platform assembly: C:\Users\Robert\AppData\LocalLow\Unity\WebPlayer\player\Release3.x.x\Assembly-CSharp.dll (this message is harmless)
Loading C:\Users\Robert\AppData\LocalLow\Unity\WebPlayer\player\Release3.x.x\Assembly-CSharp.dll into Unity Child Domain
Non platform assembly: C:\Users\Robert\AppData\LocalLow\Unity\WebPlayer\player\Release3.x.x\IFacebook.dll (this message is harmless)
Loading C:\Users\Robert\AppData\LocalLow\Unity\WebPlayer\player\Release3.x.x\IFacebook.dll into Unity Child Domain

  • Completed reload, in 0.041 seconds
    Initializing input.

XInput1_3.dll not found.
Input initialized.

desktop: 1600x900 60Hz; virtual: 1600x900 at 0,0
Using SDK 4.3.6, Build 131121.17562b74012d24a

(Filename: C:/BuildAgent/work/d3d49558e4d408f4/artifacts/WebPlayerGenerated/UnityEngineDebug.cpp Line: 53)

Platform assembly: C:\Users\Robert\AppData\LocalLow\Unity\WebPlayer\player\Release3.x.x\Data\lib\CrossDomainPolicyParser.dll (this message is harmless)
Platform assembly: C:\Users\Robert\AppData\LocalLow\Unity\WebPlayer\mono\Release3.x.x\Data\lib\Mono.Security.dll (this message is harmless)
Non platform assembly: data-12DE0018 (this message is harmless)

`

Anyway, when encounter computer errors related to xinput1_3, you can re-install DirectX or update it to the latest version to have a try. Xinput1_3.dll is a dynamic link library that used by many programs and games. It is part of DirectX and supports many functions of computer games.

Good luck.