Basic Authentication in SproutCore SC.Request

▼魔方 西西 提交于 2019-12-25 03:16:18

问题


Thanks to IAbstractDownvoteFactory for an awesome answer to my previous question

Connecting to an HTTPS service with SproutCore

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.

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?

Again, any help will be greatly appreciated! :D


回答1:


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

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

Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==



来源:https://stackoverflow.com/questions/8157016/basic-authentication-in-sproutcore-sc-request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!