如何检索从angularjs Ajax调用的响应报头中的授权令牌? [英] How to retrieve the authorization token from the response header of an ajax call in angularjs?

查看:199
本文介绍了如何检索从angularjs Ajax调用的响应报头中的授权令牌?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上标题描述了一切。我发送一个API调用,得到响应,以授权的头,我想是因为它是需要subsuquent API调用从标题检索此授权令牌。我应该如何得到这个信息?

Basically the title has described everything. I send an api call, get a response, with Authorization in the header, and I want to retrieve this authorization token from the header because it is needed for subsuquent api calls. How should I get this info?

推荐答案

您应该看看这里:的 https://docs.angularjs.org/api/ng/service/$http

$http.get('yourUrl').
  success(function(data, status, headers, config) {
    console.log(headers);
  })

这篇关于如何检索从angularjs Ajax调用的响应报头中的授权令牌?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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