views:

23

answers:

1

How do I set http header for basic authorization using YUI connection manager ?

env: yui 2.8.1

+2  A: 

The API documentation is the best place to look for features not listed in the examples. (This is true of any library, not just YUI!)

The value for a basic access authentication header should be a base 64 encoded concatenation of the username, a colon and the password.

You can include this script to base64 encode.

var encoded = Base64.encode('yourUsername' + ':' + 'yourPassword');

YAHOO.util.Connect.initHeader('Authorization', 'Basic ' + encoded, true);
David Caunt