dongli1920
dongli1920
2017-09-06 13:41
浏览 30
已采纳

在Ionic3 App和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.

图片转代码服务由CSDN问答提供 功能建议

我有Ionic3 App和Joomla Backend(api.php width所有必需的功能)

我正在使用 Http Storage 模块来连接api.php,我有成功的请求(用户/登录,用户/个人资料等...)但每次都有 我正在新的请求,我的api.php中的会话它再次生成.....但邮递员的同样请求不会生成新的会话,为什么?

例如:

如果我将从应用程序登录,我的joomla后端会话 正确,但如果我在应用中使用其他请求,那么会话将再次生成 不应该)但是宽度其他数据(会话中没有更多的user_id和其他标识符)

但来自邮递员的相同请求只会生成一个 session。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dousha1873
    dousha1873 2017-09-06 13:51
    已采纳

    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 })
    
    点赞 评论

相关推荐