2

There's a Javascript library for doing OAuth - called jsOAuth.

The examples that are available show it being used from within browsers. There are also some examples that claim to show how to use it from Node.js.

Can it also be used from ASP Classic / JScript ?

The key test would be:
can jsOAuth be used to post a Tweet on behalf of a user, from an ASP Classic page?

Cheeso
  • 189,189
  • 101
  • 473
  • 713

1 Answers1

2

No, I don't think so.

The library has a couple problems that prevent it from being used as is, from an ASP-Classic page implemented in Javascript.

  1. the basic syntax of the library assumes a require package and a well-known exports variable. These conventions aren't present in ASP Classic. Also it directly assigns properties to the global "this" object, which isn't directly possible in ASP Classic.

  2. jsOAuth presumes the presence of the map method on all Array types.

  3. jsOAuth instantiates XMLHttpRequest instances directly from the XMLHttpRequest constructor. This constructor is available in the Javascript execution environment within modern browsers, but it isn't available within ASP-Classic. The library could fall back to use new ActiveXObject("MSXML2.ServerXMLHTTP"), but it does not.

  4. The library presumes asynchronous XMLHttpRequest operation. In a browser, that works just fine. But in ASP-Classic page, the page process ends, which means pending asynchronous calls are orphaned. In the ASP-Classic environment, it would be necessary to make synchronous calls to the OAuth-protected Service Provider.


So out of the box, not possible. The other major obstacle to using it within ASP Classic is the lack of suitable documentation and examples.

It is possible to modify the library to allow it to be used in ASP Classic; I've put together a modified version. I'll post it shortly.

Community
  • 1
  • 1
Cheeso
  • 189,189
  • 101
  • 473
  • 713