GithubHelp home page GithubHelp logo

Comments (7)

s-KaiNet avatar s-KaiNet commented on June 20, 2024 2

Cool, glad it works. If you know the exact steps taken, please post here, will be useful for others.

from pnp-auth.

dannyfoncke avatar dannyfoncke commented on June 20, 2024
  • new server uninstalled node 10.15 - re-installed node 8.15
  • copy pasted the working project to the new server
  • no changes what-so-ever
  • run : same error !

AFAIK the only difference now is IISNode installed on the new server

So is IISNode intervening ? (the project is not linked - by me - in any way to IISNode)

If anybody has any pointers ... I'm taking all help I can get :)

thanks

from pnp-auth.

koltyakov avatar koltyakov commented on June 20, 2024

It might be because of IISNode. As in my scenarios 8/10 no matter work.
Unfortunately, I have no experience with IISNode so without taking a look into this have no idea so far.

from pnp-auth.

koltyakov avatar koltyakov commented on June 20, 2024

Out of interest, can you try pnp-auth's predecessors sp-pnp-node or node-pnp-js. Will it fail the same in your environment?

from pnp-auth.

dannyfoncke avatar dannyfoncke commented on June 20, 2024

using node-pnp-js : samer error

(node:8256) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token < in JSON at position 1
warning.js:18
at JSON.parse ()
at c:\Services\nodetest2\node_modules\sp-pnp-js\lib\odata\core.js:24:89

This is all the code there is

import * as pnp from 'sp-pnp-js';
import NodeFetchClient from 'node-pnp-js';

var credentials = {
    "siteUrl": "https://xxxxxxxxxxxxxxxxx",
    "strategy": "AdfsUserCredentials",
    "username": "xxxxx@xxxxxx",
    "password": "xxxxxx",
    "relyingParty": "xxxxxxx",
    "adfsUrl": "https://xxxxxxxx",
    "adfsCookie": "FedAuth"
  }
 
pnp.setup({
    sp: {
        fetchClientFactory: () => {
            return new NodeFetchClient(credentials);
        }
    }
});

new pnp.Web(credentials.siteUrl).get()
    .then(data => {
        console.log(`Your web title: ${data.Title}`);
    })

from pnp-auth.

s-KaiNet avatar s-KaiNet commented on June 20, 2024

To get rid of "Unexpected token < in JSON at position 1" you should additionally set headers: { "Accept": "application/json; odata=verbose" }.

Have you tried that?

from pnp-auth.

dannyfoncke avatar dannyfoncke commented on June 20, 2024

I've pestered the server admins and they have come with the announcements 'changed something in the host file to avoid wap' ...

Now it works. (all solutions)

Thank you very much for your time, really appreciated.

Maybe worth remembering when others come up with this error ?

from pnp-auth.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.