通过setRequestHeader授权 [英] Authorization through setRequestHeader

查看:101
本文介绍了通过setRequestHeader授权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现这个code,这使得它可以使用setRequestheader和Ajax进行身份验证。

I found this code which makes it possible to authenticate using setRequestheader and Ajax.

this.xmlDoc.setRequestHeader('Authorization','Basic ' + Base64.encode("User:Password"));

Unfortunatily我没有Ajax和Base64编码的知识似乎并不为类或方法我可以参考一下。是否有这种基本的加密方法吗?或simular连接code函数,我可以从JavaScript调用?

Unfortunatily I have no knowledge of Ajax and Base64 does not seem to be class or method I can reference. Is there an alternative for this Basic encryption? Or a simular encode function I can call from Javascript?

感谢您!

推荐答案

您需要连接code用户的功能为Base64:密码字符串。请参见这个问题这给情侣不错的选择要做到这一点在JavaScript。

You need a function to Base64 encode the User:Password string. See this question which gives a couple of good options to do this in javascript.

这篇关于通过setRequestHeader授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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