Not able to retrieve JSESSIONID cookie with AXIOSRetrieve the position (X,Y) of an HTML elementHow do I set/unset a cookie with jQuery?Local Storage vs CookiesSet cookie and get cookie with JavaScriptSet-Cookie in HTTP header is ignored with AngularJSHow to prevent JSESSIONID cookie from being encoded in HTTP request headerHow to send Basic Auth with axiosHow to set cross domain cookie in KoaConfigure Axios and Flask to use CORS with cookiesAngular 2 not passing JSESSIONID on subsequent requests

Shrink exponential fraction argument

What happens to foam insulation board after you pour concrete slab?

Traffic law UK, pedestrians

If Boris Johnson were prosecuted and convicted of lying about Brexit, can that be used to cancel Brexit?

How certain is a caster of when their spell will end?

I wrote a scene that the majority of my readers loved. How do I get back to that place while writing my new book?

Building a road to escape Earth's gravity by making a pyramid on Antartica

Short story written from alien perspective with this line: "It's too bright to look at, so they don't"

Accidentally renamed tar.gz file to a non tar.gz file, will my file be messed up

Secure offsite backup, even in the case of hacker root access

Explain Ant-Man's "not it" scene from Avengers: Endgame

Do manufacturers try make their components as close to ideal ones as possible?

Does any lore text explain why the planes of Acheron, Gehenna, and Carceri are the alignment they are?

What is a simple, physical situation where complex numbers emerge naturally?

Why is Colorado so different politically from nearby states?

Applicants clearly not having the skills they advertise

Is it legal in the UK for politicians to lie to the public for political gain?

How can Iron Man's suit withstand this?

Opposite of "Squeaky wheel gets the grease"

Accidentally cashed a check twice

What happens if you do emergency landing on a US base in middle of the ocean?

Did Darth Vader wear the same suit for 20+ years?

Java 8: How to convert String to Map<String,List<String>>?

Do I include animal companions when calculating difficulty of an encounter?



Not able to retrieve JSESSIONID cookie with AXIOS


Retrieve the position (X,Y) of an HTML elementHow do I set/unset a cookie with jQuery?Local Storage vs CookiesSet cookie and get cookie with JavaScriptSet-Cookie in HTTP header is ignored with AngularJSHow to prevent JSESSIONID cookie from being encoded in HTTP request headerHow to send Basic Auth with axiosHow to set cross domain cookie in KoaConfigure Axios and Flask to use CORS with cookiesAngular 2 not passing JSESSIONID on subsequent requests






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








-1















I am trying to call API to authenticate user. getting 200 success response but not getting JSESSIONID cookie in response.



axios.defaults.withCredentials = 'true';
axios.defaults.crossDomain = 'true';
axios.defaults.headers.post['Content-Type'] = 'application/json';
axios.defaults.headers.post['withCredentials'] = 'true';
const data =
username: this.state.user,
credential: this.state.pass


axios.post('http://3.122.7.162:5000/v60/admin/session', data)
.then(response =>
console.log("response");
console.log(response);
)
.catch(error =>
console.log("error");
console.log(error);
);


Thanks










share|improve this question






























    -1















    I am trying to call API to authenticate user. getting 200 success response but not getting JSESSIONID cookie in response.



    axios.defaults.withCredentials = 'true';
    axios.defaults.crossDomain = 'true';
    axios.defaults.headers.post['Content-Type'] = 'application/json';
    axios.defaults.headers.post['withCredentials'] = 'true';
    const data =
    username: this.state.user,
    credential: this.state.pass


    axios.post('http://3.122.7.162:5000/v60/admin/session', data)
    .then(response =>
    console.log("response");
    console.log(response);
    )
    .catch(error =>
    console.log("error");
    console.log(error);
    );


    Thanks










    share|improve this question


























      -1












      -1








      -1








      I am trying to call API to authenticate user. getting 200 success response but not getting JSESSIONID cookie in response.



      axios.defaults.withCredentials = 'true';
      axios.defaults.crossDomain = 'true';
      axios.defaults.headers.post['Content-Type'] = 'application/json';
      axios.defaults.headers.post['withCredentials'] = 'true';
      const data =
      username: this.state.user,
      credential: this.state.pass


      axios.post('http://3.122.7.162:5000/v60/admin/session', data)
      .then(response =>
      console.log("response");
      console.log(response);
      )
      .catch(error =>
      console.log("error");
      console.log(error);
      );


      Thanks










      share|improve this question
















      I am trying to call API to authenticate user. getting 200 success response but not getting JSESSIONID cookie in response.



      axios.defaults.withCredentials = 'true';
      axios.defaults.crossDomain = 'true';
      axios.defaults.headers.post['Content-Type'] = 'application/json';
      axios.defaults.headers.post['withCredentials'] = 'true';
      const data =
      username: this.state.user,
      credential: this.state.pass


      axios.post('http://3.122.7.162:5000/v60/admin/session', data)
      .then(response =>
      console.log("response");
      console.log(response);
      )
      .catch(error =>
      console.log("error");
      console.log(error);
      );


      Thanks







      javascript reactjs cookies cors axios






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 24 at 13:13







      tbaveja

















      asked Mar 24 at 4:52









      tbavejatbaveja

      238




      238






















          1 Answer
          1






          active

          oldest

          votes


















          0














          XMLHttpRequest and fetch (the built-in HTTP request libraries in browsers) do not expose information about cookies in their response object.



          It isn't even available through directly reading the Set-Cookie header because it is a forbidden response header.



          The only way to read cookie data is through document.cookie, but that only provides information about same origin cookies.



          There is no direct way to get the data from a cross-origin cookie using Ajax methods. The only way to do it would be to change the server side code so it returned a copy of the cookie data through another path that the JavaScript could read (e.g. in the response body).




          This doesn't stop you using the cookies. Unless third-party cookies are disabled, they will still be set in the browser's cookie jar and automatically sent with future requests to the domain they belong to.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55320839%2fnot-able-to-retrieve-jsessionid-cookie-with-axios%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            XMLHttpRequest and fetch (the built-in HTTP request libraries in browsers) do not expose information about cookies in their response object.



            It isn't even available through directly reading the Set-Cookie header because it is a forbidden response header.



            The only way to read cookie data is through document.cookie, but that only provides information about same origin cookies.



            There is no direct way to get the data from a cross-origin cookie using Ajax methods. The only way to do it would be to change the server side code so it returned a copy of the cookie data through another path that the JavaScript could read (e.g. in the response body).




            This doesn't stop you using the cookies. Unless third-party cookies are disabled, they will still be set in the browser's cookie jar and automatically sent with future requests to the domain they belong to.






            share|improve this answer



























              0














              XMLHttpRequest and fetch (the built-in HTTP request libraries in browsers) do not expose information about cookies in their response object.



              It isn't even available through directly reading the Set-Cookie header because it is a forbidden response header.



              The only way to read cookie data is through document.cookie, but that only provides information about same origin cookies.



              There is no direct way to get the data from a cross-origin cookie using Ajax methods. The only way to do it would be to change the server side code so it returned a copy of the cookie data through another path that the JavaScript could read (e.g. in the response body).




              This doesn't stop you using the cookies. Unless third-party cookies are disabled, they will still be set in the browser's cookie jar and automatically sent with future requests to the domain they belong to.






              share|improve this answer

























                0












                0








                0







                XMLHttpRequest and fetch (the built-in HTTP request libraries in browsers) do not expose information about cookies in their response object.



                It isn't even available through directly reading the Set-Cookie header because it is a forbidden response header.



                The only way to read cookie data is through document.cookie, but that only provides information about same origin cookies.



                There is no direct way to get the data from a cross-origin cookie using Ajax methods. The only way to do it would be to change the server side code so it returned a copy of the cookie data through another path that the JavaScript could read (e.g. in the response body).




                This doesn't stop you using the cookies. Unless third-party cookies are disabled, they will still be set in the browser's cookie jar and automatically sent with future requests to the domain they belong to.






                share|improve this answer













                XMLHttpRequest and fetch (the built-in HTTP request libraries in browsers) do not expose information about cookies in their response object.



                It isn't even available through directly reading the Set-Cookie header because it is a forbidden response header.



                The only way to read cookie data is through document.cookie, but that only provides information about same origin cookies.



                There is no direct way to get the data from a cross-origin cookie using Ajax methods. The only way to do it would be to change the server side code so it returned a copy of the cookie data through another path that the JavaScript could read (e.g. in the response body).




                This doesn't stop you using the cookies. Unless third-party cookies are disabled, they will still be set in the browser's cookie jar and automatically sent with future requests to the domain they belong to.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 24 at 13:17









                QuentinQuentin

                667k749041067




                667k749041067





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55320839%2fnot-able-to-retrieve-jsessionid-cookie-with-axios%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript