Sean Tout
Posts: 0
Joined: Sat May 10, 2014 8:07 pm

Issue with Session/cookie

Hello,

I have a very simple app.

  • one page prompts the user to login. upon successful login, user's info, including the session_id are returned + another page is loaded to display additional user data.

  • onload of the 2nd page, another service is invoked to pull other user related data.

  • nothing is passed in the request of the 2nd service. it relies on the session established to pull data.
    however I'm unable to pull any data from the 2nd service. it seems like the session_id is not being passed by the client!! below are few snippets:

    RESTService/Login Service Settings:

    Name: RESTService

    URL: http://www.sampleurl.com/login

    Method: POST

    Data Type: JSON

    Settings: None

    Security Context: None

    Content Type: JSON

    Use Appery.io Proxy: Channel-2392149

    RESTService/Login Service Response:

    {
    "header":{
    "status":200,
    "short_msg":"Login success",
    "long_msg":"You are now logged in as user111"
    },
    "body":{
    "user":{
    "user_id":"114",
    "nick":"user111",
    "password":"0c534ed3fff7d2bfd32ee19d84644e3f",
    "first":"first_user111",
    "last":"last_user111",
    "status":"1",
    "create_date":"2014-04-08 06:31:39",
    "update_date":null
    },
    "user_type":"R",
    "session_id":"92230poi43v1sn5oqb5tonpco0"
    }
    }

    the above works just fine. now to the service that doesn't work.

    UserCircle Service Settings:

    Name: userService

    URL: http://www.sampleurl.com/UserCircle

    Method: POST

    Data Type: JSON

    Settings: None

    Security Context: None

    Content Type: JSON

    Use Appery.io Proxy: Channel-2392149

    UserCircle Service Response:
    {
    "circles":[

    ]
    }

    the above is empty circles. even though the user does have few circles. I tested the same from POSTMAN (both REST Calls) and it works just fine. I tried multiple options:
    1- did not pass any parameters in the request of getCircle services (which is what the service expects). but no data back. I understood that the client automatically saves and sends the cookie/session back to the server! is that the case? or should I explicitly send the session_id?
    2- passed session_id as a header variable and as part of JSON request but no response.

    Any help would be much appreciated!

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Issue with Session/cookie

Hi Sean,

How does your server read session id? Do you need to pass it in request?

Sean Tout
Posts: 0
Joined: Sat May 10, 2014 8:07 pm

Issue with Session/cookie

Hi Katya,

it does not require the session id to be passed in the request. but rather relies on the default browser behavior around cookies. it's a standard Apache Server with PHP! I do not explicitly specify any session info in the requests I make in POSTMAN!

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Issue with Session/cookie

Hi Sean.

Automatic cookies will not work when you use cross domain request.

In your case app located on appery.io domain. And your service on other domain. For security reason it could not be stored and used properly automaticaly.

So if you need this cookie you have to get this from headers from from your response and save it in LSV.

After you can use it when send request to your service.

If you will have a problem with this please provide us screen shots from "net" debuger tab where we can see all headers and request parameters.

Regards.

Sean Tout
Posts: 0
Joined: Sat May 10, 2014 8:07 pm

Issue with Session/cookie

Hi Yurii,

Do you have an email I can the details to? I have a number of debug outputs that I'd like to share directly rather than a public forum!

Regards,

Sean.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Issue with Session/cookie

Hello!

Please send details to a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a with a link to this thread.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Issue with Session/cookie

Hello Seon,

We need the project on the Appery.io, not exported sources. We can't do anything with such sources, it is even out of our scope. What logs / password should we use? What should we look at? Please tell us the steps to reproduce error.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Issue with Session/cookie

Hello Sean,

Did you get it worked?

Return to “Issues”