angularjs - Pass cookie created by API back to API from Angular app -


I have an API that creates a session cookie called 'web_api'. Then I would like to access that cookie in my augile app so that I can return it to the API for authorization purposes. However, yields undefined using $ cookies.web_api and $ cookiestore.get ('web_api').

Is it any way to pass this cookie back to my API with the Angiari app?

My service code is as follows:

  app.service ('apiService', function ($ Http, $ q, $ cookies, $ cookiestore) {var host = ' Https://127.0.0.1:12344/v1/ 'function test_cookie () {console.log ($ cookies.web_api); console.log ($ cookieStore .get (' web_api '));}});    

I access the API endpoint to access-control- credentials = true and when I made the request, I set the credentials: true on request, for example

  function getUserId () {var idPath = 'UserId 'Var request = $ http ({method:' get ', url: buildUrl (idPath), with credentials: true}); Return (request.then (handleSuccess, handleError)); }  

This problem was resolved.

This answer was based on the document available here:


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -