Skip to content
This repository was archived by the owner on May 2, 2022. It is now read-only.

SyntaxError: Unexpected token } in JSON at position 3 when login #8

Open
linonetwo opened this issue Jan 1, 2020 · 2 comments
Open

Comments

@linonetwo
Copy link

linonetwo commented Jan 1, 2020

I'm trying to login to LDP idp: 'https://localhost:8443/'

(node:53800) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token } in JSON at position 3
    at JSON.parse (<anonymous>)
    at SolidClient.performLogin (/xxx/node_modules/@solid/cli/src/SolidClient.js:186:31)
      const consentUrl = new URL(authUrl);
      const search = consentUrl.search.substring(1);
      let consPostData = JSON.parse('{"' + decodeURIComponent(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/\=/g, '":"') + '"}');

where search is "", so JSON to be parsed will be {""}

@jaxoncreed
Copy link
Contributor

Good catch! I'll approve a merge if you create a PR.

@linonetwo
Copy link
Author

linonetwo commented Jan 8, 2020

Actually I wanna discuss why there might be no search when I login.
But it is a week before, I have fixed this problem and forget what I did wrong in server setup.

I can check if this search string is empty, but usually that means something wrong in server setup.

linonetwo added a commit to linonetwo/solid-cli that referenced this issue Jan 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants