LinkUserFacebookAccount in Unity Editor throws unauthorised

0 votes

Hello Shephertz,

I am trying to implement facebook login in my app, since I am only testing things for now, I run everything in the editor. However upon calling LinkUserFacebookAccount I get:

Exception : com.shephertz.app42.paas.sdk.csharp.App42SecurityException: {"httpErrorCode":"401", "appErrorCode":"1401", "message":"UnAuthorized Access", "details":"Client is not authorized"}

I already checked and double check my app id, so im thinking this is because of device time settings, Is there any way I can set it in unity3d for the editor? Or is this happening because of a totally different issue?



update: After further investigation this is happening also with authenticate and signup methods of App42, so I dont think this is a facebook issue
update2: After disabling replay attack protect, the error still persists, so it is not caused by device time

update3: reseting appkey and secret does not solve the problem

asked Aug 3, 2015 in App42 Cloud API-BaaS by armin65 (39 points)
edited Aug 4, 2015 by armin65

2 Answers

0 votes
Hello Armin,
Could you please share some more details like code snippets and internal logs of this method and type of your App42 App (ACL enable or not)? It will help us to provide better support to you. 
To print internal logs, put the below line of code just after the key initialization:
Please share this information with us at
Himanshu Sharma


answered Aug 4, 2015 by hs00105 (2,005 points)
0 votes

Ok after a long while and a lot of troubleshooting, I found out that for some reason a session Id and a bAccesstoken got saved in the installation and stayed there, so that everytime I was trying to ask for a service they got passed along, this resulted in an unauthorized access( since both fbaccesstoken and session Id were expired of course) So I called these three functions at the start:


        Installation.RemoveFBAccessToken ();

        Installation.RemoveLoggedinUser ();
        Installation.RemoveSessionId ();


This solved the problem But Im still unsure about what happened here and If I have to manage the token and/or sessionId manually in future. Or this also might be some Unity editor related issue that does not persist in the actual build. Some thoughts from Shephertz developers would be welcome.




answered Aug 6, 2015 by armin65 (39 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on