简体   繁体   English

将cookie从Rails API发送到Ionic构建,Ionic没有收到该cookie

[英]Sending cookie from Rails API to Ionic build, Ionic doesn't receive the cookie

I am sending a cookie back from a Rails API to an Ionic cell phone app, which for testing purposes I am first running in the browser. 我正在将cookie从Rails API发送回Ionic手机应用程序,出于测试目的,我首先在浏览器中运行它。

Here is the Rails code in question. 这是有问题的Rails代码。

cookies[:cookie_test] = { value: 'cookie received', expires: 1.year.from_now, domain: :all }

I am using Chrome dev tools to see what cookies are stored, and I can't find the cookie I'm trying to set. 我正在使用Chrome开发者工具来查看存储了哪些Cookie,但找不到我要设置的Cookie。

Is there a configuration flag I'm missing? 我是否缺少配置标志?

I don't think you are supposed to use cookies when building mobile applications, you should do it through Authorization headers, I explain this further on: 我认为您在构建移动应用程序时不应该使用cookie,而应该通过Authorization标头来实现,我将在以下方面作进一步说明:

http://apionrails.icalialabs.com/book/chapter_five#cha-chapter_five http://apionrails.icalialabs.com/book/chapter_five#cha-chapter_five

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM