+ Reply to Thread
Results 1 to 10 of 10

Thread: Set Cookie Header

  1. #1
    Join Date
    Oct 2017
    Posts
    7

    Default Set Cookie Header

    Hi,

    I am calling the API through an external app and I need to pass the session id as http request header. However none of my attempt to set the cookie header worked.

    has anyone an idea of what I am doing wrong ?

    Here is the main process I use:

    //the session id was grabbed from the login response cookie header
    var theCookie = "_session_id=XXXXXXXXXXXXXXXXXXX";

    //addHeader is a local function to add header to a http request

    //don't work
    addHeader("Cookie", theCookie );

    //don't work
    addHeader("Set-Cookie", theCookie );

    //don't work
    addHeader("cookie", theCookie );


    //don't work
    addHeader("set-cookie", theCookie );

    Any ideas ?

    Thanks in advance,
    Loic

  2. #2
    Join Date
    Oct 2017
    Posts
    7

    Default Good syntax

    In case it could help anyone, the syntax to use is
    "Cookie" for the header name
    &
    "_session_id=XXXXXXXXXXXXXXXXXXXX"
    for the cookie value.

    It didn't fix my issue but thanks to a nice EFI guy, I got this syntax confirmation.

    FWIW

    Loic

  3. #3
    Yusuke_K is offline Senior Fiery Forum Contributor Yusuke_K is on a distinguished path
    Join Date
    Jul 2009
    Posts
    70

    Default

    Hi Loic,

    You should also look at our sample codes.

    NodeJS
    https://github.com/fieryapi/node-js-samples

    .NET
    https://github.com/fieryapi/dot-net-samples

    We hope this helps!
    Yusuke

  4. #4
    Join Date
    Oct 2017
    Posts
    7

    Default Still in trouble

    Quote Originally Posted by Yusuke_K View Post
    Hi Loic,

    You should also look at our sample codes.

    NodeJS
    https://github.com/fieryapi/node-js-samples

    .NET
    https://github.com/fieryapi/dot-net-samples

    We hope this helps!
    Yusuke
    Hi Yusuke,

    It's becoming weirder and weirder. So I can get to login and get server status.
    However, when I try to get infos, I get a 401 error even with setting the cookie.

    Status is ok


    Info fails


    Any ideas ?

  5. #5
    Yusuke_K is offline Senior Fiery Forum Contributor Yusuke_K is on a distinguished path
    Join Date
    Jul 2009
    Posts
    70

    Default

    Hi Loic,

    GET status is always available even without login.

    Your screenshot and Error 401 indicate that you aren't properly logged in to the server.

    If you could log in could you please provide a screenshot of the login response?

    Thank you,
    Yusuke
    Last edited by Yusuke_K; 10-27-2017 at 10:54 AM.

  6. #6
    Join Date
    Oct 2017
    Posts
    7

    Default

    Hi Yusuke,

    Thanks a lot for the interest and support.

    [EDIT] I forgot to set API version to 4 in the HTTP Call
    So now it's working through Postman but not in my target app :\
    [/EDIT]

    So here is what I get on login:

    Then right away when I try to get infos:


    Do you see something obvious ?
    Last edited by loicaigon; 10-27-2017 at 11:53 AM.

  7. #7
    Join Date
    Oct 2017
    Posts
    7

    Default Connection issues

    Hi Yusuke,

    Thanks a lot for the interest and support.

    So here is what I get on login:

    Then right away when I try to get infos:


    Do you see something obvious ?

  8. #8
    Yusuke_K is offline Senior Fiery Forum Contributor Yusuke_K is on a distinguished path
    Join Date
    Jul 2009
    Posts
    70

    Default

    Hi Loic,

    Looks like login isn't successful. I see no response? You should be getting something like this if it was successful.

    {
    "time": "2017-10-25T12:15:45-07:00",
    "data": {
    "kind": "FieryCutSheetAuthentication",
    "item": {
    "authenticated": true,
    "fiery": true
    },
    "_links": [
    {
    "rel": "self",
    "href": "https://your server IP/live/api/v4/login"
    }
    ]
    }
    }

    Thanks,
    Yusuke

  9. #9
    Join Date
    Oct 2017
    Posts
    7

    Default

    Hi Yusuke,

    I think I have the sucess json back (see highlighted line).



    However what I can notice different between Postman and my app is that the connectionn doesn't seem to be kept alive.

    I tried to set header (Connection, Keep-Alive) but none of my attempts produced any result :\

    PS: Just to give more details, I do two HTTPS call, first is to login, second to get infos. The image is a snapshot of my logs.

  10. #10
    Join Date
    Oct 2017
    Posts
    7

    Default

    Hi Yusuke,

    Ok, I do think it's a connection not being kept alive which is the source of my troubles. However I think it's all about the third party editor responsability if I am right.

    Will come back to you when I have more infos.

    Thanks for all the care,

    Loic

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts