Search code examples
phpangularsessionionic-frameworkjoomla

Share Session Between Ionic3 App and Joomla


I have Ionic3 App and Joomla Backend (api.php width all required functions)

I am using Http, and Storage modules to connect api.php, I have Successful requests (user/login, user/profile etc..) but every time I am making new request, session in my api.php It is generated again..... but same requests from postman not generates new session, why?

For example:

If I will log-in from app , session in my joomla backend is right, but if I will use other request in my app then session will generated again (should not) but width other data (no more user_id and other identifers in session)

but same requests from postman, will only generate one session.


Solution

  • Try like this

    let options = new RequestOptions({ headers: headers, withCredentials: true });
    

    then

    http.get(url, options)
    

    or for post

    let body = JSON.stringify({key: someValue}); // data you want to send to the backend
    // let body = JSON.stringify(jsonData); // data you want to send to the backend
    http.post(url, body, options)
    

    if you are usign HttpClient

    http.get(url, { headers: headers, withCredentials: true })