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

Checking if the loginUrl already contains a "?" fails #15

Open
matleppa opened this issue Sep 25, 2018 · 1 comment
Open

Checking if the loginUrl already contains a "?" fails #15

matleppa opened this issue Sep 25, 2018 · 1 comment

Comments

@matleppa
Copy link

matleppa commented Sep 25, 2018

In file meteor-accounts-oidc/packages/switch_oidc/oidc_client.js it si checked, if loginUrl already contains a "?".

The checking is done with this piece of code:

  // check if the loginUrl already contains a "?"
  var first = !loginUrl.indexOf('?') === -1;
  for (var k in options) {
    if (first) {
      loginUrl += '?';
      first = false;
    }
    else {
      loginUrl += '&'
    }
    loginUrl += encodeURIComponent(k) + '=' + encodeURIComponent(options[k]);
  }

It seems that it is trying to return the negation of status, whether "?" is included in URL or not.
However, it returns always false, which then later is interpreted, that the "?" was present.

So in case "?" was not there, it is not added, thus causing sent request to fail.

I think that the correct piece of code were following:

var first = loginUrl.indexOf('?') === -1;

Of course there is a workaround: always add "?" in the loginURL, but the bug should be fixed, the sooner the better.

@valerytschopp
Copy link
Member

Hi @matleppa, can you provide a pull request for this change?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants