I have a rest call which works fine when i log in to the parent site ( the site which provides the rest call) from another browser tab. But when i use the call directly, (without logging in to the site from another tab) i'm getting error 401 Unauthorised. This is expected, but how do i authenticate my rest call?
On searching the internet, i've seen a bunch of codes using this:
proxy:{
type: 'rest',
url: 'somesite.com/restservice1',
method: 'GET',
username: 'user1',
password: 'pass'
}
and also this:
proxy:{
type: 'rest',
url: 'somesite.com/restservice1',
method: 'GET',
extraParams:{
username: 'user1',
password: 'pass'
}
}
None of them work. How do i get it working? As many sites (almost all of them) use authentication with their rest services, there's got to be a way.
but it just appends the username and password to the url. i wanted something that actually authenticates before calling the rest service. is that possible?
The rest proxy isn't going to do that. You would need to send an initial request or on the server if not logged in and the username/password is in the request attempt an auto login.
okay, so is there a way to send a request for authentication from the app itself? also, i didn't get you about the auto login. (by the way, i'm still learning sencha. so i'll probably have a lot of questions )