openid / AppAuth-JS

JavaScript client SDK for communicating with OAuth 2.0 and OpenID Connect providers.
Apache License 2.0
977 stars 162 forks source link

Isolate Requestor API from JQuery. #47

Closed dwaite closed 6 years ago

dwaite commented 6 years ago

A patch to make the interface for the Requestor types depend on a more constrained set of options, and to not require JQuery, while still aiming to maintain a runtime-compatible interface.

dwaite commented 6 years ago

Note: I could also create a patch using something like lquixada/cross-fetch , but the comments made me think that fetch polyfill usage had been evaluated and rejected.

dwaite commented 6 years ago

Also I am curious about the reason why this change is being made. What was the original problem which you were trying to solve.

Rather than my code requiring jQuery, I implemented a fetch-based requestor. I still had to bring in jQuery (apparently I misunderstood the error and just needed the types at compile time - which makes more sense) and had to reverse engineer which parts of the very large jQuery.xhr API was actually used. Not having any contract for that subset of the API meant that my fetch-based requestor could break at any time.

Once I started fiddling with it, it seemed like something I could clean up and offer to contribute back.

tikurahul commented 6 years ago

The only dependency we have are on the typings and not jQuery itself.

I think we could consider re-purposing the types defined in what-wg fetch. Rather than define a subset, I think that might make things easier to reason about.

dwaite commented 6 years ago

Would a PR using whatwg-fetch be desirable? I wouldn't mind tinkering with that at all.

tikurahul commented 6 years ago

Yes. I think so. I think that is the API more developers are going to be familiar with going forward.

dwaite commented 6 years ago

Closing, replaced with #48