角:从一个请求获取cookie并在另一个使用 [英] Angular: get cookie from one request and use in another

查看:122
本文介绍了角:从一个请求获取cookie并在另一个使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有简单的角度应用程序,它可以执行超过 $ HTTP 部分请求远程服务(CouchDB的) example.com / ... /为MyService 。服务需要身份验证,它通过调用指定的地址 example.com/_session 与名和密码,并将其与会话cookie返回 AuthSession 。问题是,当对服务请求完成的cookie不被使用。也许问题造成的,因为cookie是每个会话仅HTTP(而这不能更改)。

我觉得溶液从AUTH响应,存储抢夺饼干,迫使其投入使用手动调用。但我不知道如何:


  1. 从$ HTTP响应获取的cookie

  2. 使用$ HTTP响应
  3. 强制

有什么建议?

UPD:图片

所有Cookie

所有Cookie

但仅此

只提供饼干

验证cookie,它发送到 / _会议的要求,而不是别人。

在这里输入的形象描述


解决方案

有没有解决的办法,根据这个

现在我认为,CouchDB是问题的根源。
所以,我会尽力找到另一个方法做手工AUTH在沙发上。

I have simple Angular app, which can perform some requests over $http to remote service (couchdb) at example.com/.../myservice. Service requires auth, which done by calling specified address example.com/_session with name and password and it returns with session cookie AuthSession. Problem is that cookie is not used when calls to service is done. Maybe problem caused because cookie is per-session Http-only (and that's can't be changed).

I think the solution is grabbing cookie from auth response, store and force it into service calls manually. But I don't know how to:

  1. Get cookie from $http response
  2. Force it with $http response

Any suggestions?

UPD: pics

All cookies

but available only this

Auth cookie, which sent to /_session request, but not to others

解决方案

There's no solution, according to this

Now I think that couchdb is a source of problem. So, I'll try to find another ways to do auth in couch manually.

这篇关于角:从一个请求获取cookie并在另一个使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆