2207 Session Id not valid

0 votes
Hi all

I am working on a acl enabled app. I could create user by using "userService.CreateUser(userName,pass,email,new CreateUserCallback());" untill now. But later I could not because it gives me 2207 error. My first question why and how I could create user before and not now? What changed? Second what is the way of solving it? Should I setAdminKey before CreateUser function?

Thanks
asked May 23, 2016 in Unity by gokhan (20 points)
I added setAdminKey before createUser api and I again could manage to create user. Later I commented setAdminKey, I still can create user.  I did not understand what acl does if I can create user sometimes and sometimes not. Please dont send me link http://api.shephertz.com/tutorial/Securing-Your-App/ I already read it.

1 Answer

0 votes
Hi Gokhan,

 

At the time of calling createUser function, you don't require to set Admin key in service instance. If you can share internal logs of method than it will help me alot to asnwer your query. Please print internal logs of App42 methods when you are experiencing 2207 expetion.

To print internal logs, put the below line of code just after the key initialization:

App42Log.SetDebug(true);

 

Regards,

Himanshu Sharma
answered May 24, 2016 by hs00105 (2,005 points)
Hi Himanshu
I debug the logs. I see that I have a 1401 "Client is not authorized to create session" error. It happens because I call sessionService.GetSession(userName,new session()); to compare local session id and server sessionid for silent login. I tried to put sessionService.SetSessionId(localSession); but no change. I still get 1401 error. So what is the solution for this? I need to compare somehow local and server session.And below is the full logs

1-apiKeyxxxxxxxxxxxxxx{"app42":{"session":{"userName":"mnmn"}}}sessionId65ae0527-2a41-4686-aca4-3162603c49e2timeStamp2016-05-24T10:23:48.567Zversion1.0
2-GetInstance Not Null
3- QueryString is ?
4-POST URI : https://api.shephertz.com/cloud/1.0/session?
5-Waiting For Response...
6-errorValue : {"app42Fault":{"httpErrorCode":401,"appErrorCode":1401,"message":"UnAuthorized Access","details":"Client is not authorized to create session"}}
I need to know more about acl. Can you please explain when to use setSessionId or when to use setAdminKey? Also what I did not understand is that: Acl is necessary because someone can get your api and secret key from local and hack it. But if I use setAdminKey, they can also get my admin key as well:) So what is the logic? For instance I put setadminkey before GetSession and problem solved. I dont get 1401 error. So Should I put setadminkey everywhere?
Hi Gokhan,

I believe your above query has been resolved, please let me  know if you need any help from my side.

I will be happy to assist you.

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
...