CRUDE-ASP icon indicating copy to clipboard operation
CRUDE-ASP copied to clipboard

OAuth authentication

Open EitanBlumin opened this issue 6 years ago • 1 comments

Example:

http://scottdesapio.com/VBScriptOAuth/

Alternatively, consider using HTML 5 worker object:

https://www.w3schools.com/html/html5_webworkers.asp

Other options:

https://tests4geeks.com/oauth2-javascript-tutorial/

https://www.codeproject.com/Articles/579564/JavaScript-oAuth

https://github.com/oauth-io/oauth-js

https://docs.microsoft.com/en-us/outlook/rest/javascript-tutorial

https://tools.chilkat.io/msgraph_oauth2.asp

EitanBlumin avatar Mar 25 '19 05:03 EitanBlumin

Window hash parameter parser:

const result = document.querySelector("#result");
const hash2Obj = window.location.hash.substr(1)
      .split("&")
      .map(v => v.split("="))
      .reduce( (pre, [key, value]) => ({ ...pre, [key]: value }), {} );
          

result.textContent += `loc => ${hash2Obj.loc}
----
*hash2Obj (stringified):
${JSON.stringify(hash2Obj, null, ' ')}`;

Another example:

function parseParms(str) {
    var pieces = str.split("&"), data = {}, i, parts;
    // process each query pair
    for (i = 0; i < pieces.length; i++) {
        parts = pieces[i].split("=");
        if (parts.length < 2) {
            parts.push("");
        }
        data[decodeURIComponent(parts[0])] = decodeURIComponent(parts[1]);
    }
    return data;
}

console.log(parseParms("aaa=1&bbb=99&name=Bob"));

EitanBlumin avatar Apr 06 '19 07:04 EitanBlumin