Giter Club home page Giter Club logo

Comments (11)

EmilStenstrom avatar EmilStenstrom commented on September 21, 2024

To clarify my use-case even more:

I would like to listen to readystate == 3, and read the partial response from xhr.responseText. This does not work in IE, so I don't expect support for this in jsOAuth. What I would like, is a way to write the plumbing for that myself, and somehow just use the OAuth signing from jsOAuth.

from jsoauth.

bytespider avatar bytespider commented on September 21, 2024

How about something like:

    var xhr = oauth.signedXMLHttpRequest({
        method: "GET",
        url: "http://bytespider.eu",
        data: {message: "this is cool"},
        headers: {"Content-Type": "application/x-www-form-urlencoded"}
    });

Clearly this method you'd have to handle some stuff yourself like how to encode any data you need to send.

Alternatively:
I can add readystatechange as an option to oauth.request() which would replace the built in one.

from jsoauth.

EmilStenstrom avatar EmilStenstrom commented on September 21, 2024

Yes, the first alternative sounds like a great one!

from jsoauth.

EmilStenstrom avatar EmilStenstrom commented on September 21, 2024

Here's a working example of what I'm trying to do: http://stackoverflow.com/a/8752044/117268 - I just need OAuth instead of Basic Auth now.

from jsoauth.

sfrenot avatar sfrenot commented on September 21, 2024

Hello guy, I have made the oauth work with streaming twitter. It is mostly working from the origin but there were some problems.

I had to remove the header callback, since keys were not well calculated.

headerParams = {
//'oauth_callback': oauth.callbackUrl,
...

As, you said I had to manage the stream away from this condition :
if (xhr.readyState === 4) {
I put some very bad stuff before, just to see that it works, such as
xhr.onreadystatechange = function () {
success(xhr);
if (xhr.readyState === 4) {

from jsoauth.

bytespider avatar bytespider commented on September 21, 2024

I'm sorry I don't understand. Can you be clearer? Please submit a pull request if you have code you would like to share.

from jsoauth.

bguiz avatar bguiz commented on September 21, 2024

+1 vote for this as well - I asked this question prior to finding this issue: http://stackoverflow.com/questions/11374771/how-to-make-twitter-streaming-apis-work-with-jsoauth

from jsoauth.

bytespider avatar bytespider commented on September 21, 2024

jsOAuth 2.0 will support a way to craft and use your own XHR objects and callbacks.

from jsoauth.

bguiz avatar bguiz commented on September 21, 2024

@bytespider Thanks for the update - looking forward to 2.0!
Any word on the rough timeline to expect for this?

from jsoauth.

bytespider avatar bytespider commented on September 21, 2024

Sadly not. I may do a pre-release without OAuth 2.0 support just to get the code out there.

from jsoauth.

bguiz avatar bguiz commented on September 21, 2024

@bytespider Yeah that pre-release sounds like a great idea!

from jsoauth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.