Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OAuth authentication #97

Open
EitanBlumin opened this issue Mar 25, 2019 · 1 comment
Open

OAuth authentication #97

EitanBlumin opened this issue Mar 25, 2019 · 1 comment
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@EitanBlumin EitanBlumin self-assigned this Mar 25, 2019
@EitanBlumin EitanBlumin added the enhancement New feature or request label Mar 25, 2019
@EitanBlumin EitanBlumin added this to the Dynamic Security milestone Mar 25, 2019
@EitanBlumin EitanBlumin modified the milestones: Dynamic Security, Beta release, Alpha release phase 2 Mar 26, 2019
@EitanBlumin EitanBlumin added the help wanted Extra attention is needed label Apr 4, 2019
@EitanBlumin
Copy link
Owner Author

EitanBlumin commented Apr 6, 2019

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"));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant