SproutCore SC.Request中的基本身份验证 [英] Basic Authentication in SproutCore SC.Request

查看:159
本文介绍了SproutCore SC.Request中的基本身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

感谢IAbstractDownvoteFactory对我之前的问题的一个很棒的答案

Thanks to IAbstractDownvoteFactory for an awesome answer to my previous question

使用SproutCore连接到HTTPS服务

此问题基于此。我的问题是,服务器需要我登录。现在,出于开发原因,我不需要用户填写表单。此外,即使发布此应用程序,用户也无需登录。

This question is based off that. My question being, the server needs me to log in. Now, for dev reasons, I don't need the user to fill out the form. Additionally, even when this app is released, the user will NOT need to log in.

因此,用户名和密码仅用于开发目的。但是,它就在那里,我不想看到浏览器的popUp窗口。有什么方法可以在回调函数中处理身份验证吗?

Thus, the username and password is only for dev purposes. However, it is there, and I don't want to see the browser popUp window. Is there any way in which I can handle authentication in the callback function?

再一次,任何帮助将不胜感激! :D

Again, any help will be greatly appreciated! :D

推荐答案

SC.Request 支持标题(键,值)函数,因此您可以尝试注入基本身份验证标题。

SC.Request supports the header(key, value) function so you can try injecting the basic authentication header yourself.

将密钥设置为授权,将值设置为base64_encode(用户名:密码)。

Set the key to "Authorization" and the value to base64_encode("username:password").

授权:基本QWxhZGRpbjpvcGVuIHNlc2FtZQ ==

这篇关于SproutCore SC.Request中的基本身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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