Results 1 to 5 of 5

Thread: Rest Services Authentication

  1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    3
    Vote Rating
    0
      0  

    Default Rest Services Authentication

    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.

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    extraParams will send the username/password as parameters. Is that what your setup is needing?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    3
    Vote Rating
    0
      0  

    Default

    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?

  4. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    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.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  5. #5
    Sencha User
    Join Date
    Apr 2012
    Posts
    3
    Vote Rating
    0
      0  

    Default

    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 )

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •