PDA

View Full Version : Basic Authentication



jhennard
22 Dec 2012, 4:18 PM
I would like to send basic authorization headers when using the save method on a model. Does anyone know what the correct approach is?

My initial attempt...

model.save({
headers: {
'Authorization': 'Basic ' + Base64.encode('username:password')
},
username: 'username',
password: 'password',
withCredentials: true
});

ingo.hefti
24 Dec 2012, 2:19 AM
The way I use it is by just setting the headers (as you do) and making sure that it's a POST. Setting username and password again is not necessary in my case.

vnggui
5 Mar 2013, 4:39 PM
I run Base64.encode('user:password'), but throws :

Uncaught ReferenceError: Base64 is not defined

Where can we find Base64?

thanks,

vng

ingo.hefti
5 Mar 2013, 11:05 PM
maybe this helps: http://www.sencha.com/forum/showthread.php?251508