I need to invoke restful webservices in Sproutcore which requires authentication header for http request. I write a code like in Sproutcore:
authHeader: function () {
var userAndPass = "username:password";
var auth = "Basic " + Base64.encode(userAndPass);
return auth;
},
However, when I run it, sadi Base64 is not defined.
Anybody knows how to fix it or do it in sproutcore. Thanks
使用btoa()
进行Base-64编码。
var auth = "Basic " + btoa(userAndPass);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.