1401 Un Authorized Access Error

0 votes
Hi All

I have a ACL enabled game.I wanted to test my facebook login feature. What I am doing now with facebook is that: when user link his facebook account, I save his fbUserId to user's data table which includes his username etc. Then, next time when he clicks login with facebook button, I get username whose fbUserId equals current user id. Then, on server side I use GetSession(create) api using this username and login to game. After I login, I can use storage service etc but while I am trying to use buddy service, it fires 1401 error. What is the problem here? I created session for the user and everything should be fine!

Thanks

Gökhan
asked Feb 7, 2017 in Unity by gokhan (20 points)

1 Answer

+1 vote

Hi Gokhan,

 

You need to set the session id of the user in BuddyService instance to call any API of buddy service. Please have a look at this tutorial for more detail and let us know if you still face any issue.

 

regards,

Himanshu Sharma

answered Feb 8, 2017 by hs00105 (2,005 points)
Hello my friend,
I read many times the tutorial you sent me, believe me. But it is not clear enough. I did not need setSessionId api for other services like storage service. Why did I need it for buddy service? Which other service will also need this? I need more clear answers. Btw, problem solved when I used setSessionId api. Another question: when I authonticate using auth api no problem occur with buddy service. So it means, at background, it passes session id with buddy service?
I will be happy if I find answers to my questions...
Hi Gokhan,

By default in authenticate function, we set session id internally and save that id in local preference. So that every time user don't need to set the session id.

But if you called social service API or logout API of User Service, we clear the local session of users from player preference. That's why you need to set the session id again while calling the buddy service if you log in with Facebook account.

Let me know if it answers your question.

Regards,
Himanshu Sharma
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 support@shephertz.com
...