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 Is it any way to pass this cookie back to my API with the Angiari app? My service code is as follows: I access the API endpoint to This problem was resolved. This answer was based on the document available here: undefined
using $ cookies.web_api
and $ cookiestore.get ('web_api').
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 '));}});
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)); }
Comments
Post a Comment