Results 1 to 8 of 8

Thread: OAuth

  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    127
    Answers
    4

    Question OAuth

    Any examples on how to use OAuth from within a Sencha Touch application?

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,449
    Answers
    3997

    Default

    Tried searching and nothing really usable. Does the service you are using support JSONP? That is really the biggest thing I could see to get around. Other than that is just creating some ajax calls (and maybe encryption) to do what they want.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3

    Default Oauth

    I too would really love something using oauth, or a childbrowser of some sort.

    I'm using salesforce and no, they don't support jsonp for authentication, I've been trying to get the ChildBrowser.js to work with xcode, and sencha but no go...

  4. #4
    Sencha User
    Join Date
    Feb 2012
    Location
    New York, NY
    Posts
    52
    Answers
    1

    Default

    We're currently using jsOAuth with Sencha but it's for OAuth 1.0 and requires cross-domain XMLHttpRequests, ie: only works in a phonegap or sencha native wrapper app.

    https://github.com/bytespider/jsOAuth

  5. #5

    Default boo

    unfortunately I do need oauth 2, but I'll def look into it anyway.

  6. #6

    Default

    jensenaxel : The only way I can think of connecting to salesforce.com is using ' Force.com JS REST Toolkit' however that requires a local hosting of a Proxy.php to route the REST API calls to SF so as to overcome 'Cross Domain' policy issue

    I have posted another thread for the same which you could keep a tab on.
    http://www.sencha.com/forum/showthre...ght=connecting

  7. #7
    Sencha User
    Join Date
    Jul 2012
    Posts
    13

    Default

    I got the bytespider jsOAuth working like a charm, but when it comes to the store-proxy-integration I don't know where ot start.
    Maybe you have a hint.

    When I call oauth.get('...') evereything works fine, but how do I tell my store to use the oauth as proxy instead of it's usual ajax behavior. Or am I missing something?

    Thx,
    Axel

  8. #8
    Sencha User
    Join Date
    Jul 2012
    Posts
    13

    Default

    Quote Originally Posted by axeff View Post
    When I call oauth.get('...') evereything works fine, but how do I tell my store to use the oauth as proxy instead of it's usual ajax behavior. Or am I missing something?
    Solved it.
    I modified jsOAuth to my own needs (https://github.com/axeff/jsOAuth, hopefully it will be in the next version) and added a "public" function getHeaderString() which returns the needed header-information.
    This needs to be called before every request, because the timestamp, nonce and signature needs to be re-done everytime.

    so this is how it looks now:
    Code:
    var store = Ext.StoreManager.lookup("...");
    var url = store.getProxy().getUrl();
    store.setProxy({headers: {'Authorization': 'OAuth ' + oauth.getHeaderString(url)}})
    store.load();
    Would probably be a good idea to overwrite the load function to automatically call setProxy() before loading.

Posting Permissions

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