sharepoint-nodejs / pnp-auth Goto Github PK
View Code? Open in Web Editor NEWnode-sp-auth with pnp/pnpjs (aka PnPjs) integration
License: MIT License
node-sp-auth with pnp/pnpjs (aka PnPjs) integration
License: MIT License
Hello,
I'm using pnp-auth a lot :) thank you for providing this lib
I'm trying to use isolated sp objects with pnp-auth but I get the following error :
TypeError: safe_global_js_1.safeGlobal.fetch is not a function
(node:13276) UnhandledPromiseRejectionWarning: TypeError: safe_global_js_1.safeGlobal.fetch is not a function
at FetchClient.fetch (C:\Projects\sptoolkit-projects\packages\common\net.ts:66:27)
at SPHttpClient.retry (C:\Projects\sptoolkit-projects\packages\sp\sphttpclient.ts:122:24)
at C:\Projects\sptoolkit-projects\packages\sp\sphttpclient.ts:144:19
at new Promise ()
at SPHttpClient.fetchRaw (C:\Projects\sptoolkit-projects\packages\sp\sphttpclient.ts:142:16)
at SPHttpClient. (C:\Projects\sptoolkit-projects\packages\sp\sphttpclient.ts:82:21)
packages used :
"@pnp/nodejs-commonjs": "^2.6.0",
"@pnp/sp-commonjs": "^2.6.0",
"pnp-auth": "^2.0.0",
Code that produces the error:
import { bootstrap, } from 'pnp-auth';
import { sp } from '@pnp/sp-commonjs';
import { AuthConfig, } from 'node-sp-auth-config'
const isolatedSP = await sp.createIsolated()
const authConfig = new AuthConfig({
authOptions: thecredsobject
});
bootstrap(isolatedSP, authConfig)
The same code works with the standard sp object (from the import)
.....
bootstrap(sp, authConfig)
I hope you can point me to my error or fix the problem ?
thanks again
gr
Hello,
I have installed
@pnp/sp - 2.0.3
@pnp/pnpjs - 2.0.3
@pnp/common - 2.03
@pnp/logging - 2.0.3
@pnp/nodejs-commonjs - 2.0.3 -- added but not used
@pnp/sp-common - 2.0.3 -- added but not used
@pnp/odata - 2.0.3
pnp-auth - 0.0.4
sp-pnp-node: 2.2.0
and trying to do a simple
import {sp} from '@pnp/sp
bootstap(sp, ..private.json, siteURL)
I am getting the below compilation errors
2.HttpClientImpl
node-modules/pnp-auth/lib/NodeFetchClient.d.ts:1:26 - error TS274 : Module ..../@pnp/common has no exported member 'HttpClientImpl' Did you mean IHttpClientImpl
Any suggestions on where I am going wrong ..
Thanks
Is there a way to use this with the v3 @pnp libraries?
I have a misbehaving SP with frequent timeouts that I can't do anything about. I would like to make it so GET requests have a short timeout (default seems to be 15 minutes) and are retried 3 times when they time out.
It seems that I have to monkey-patch node-fetch's fetch
to do so, but it would be nice to provide a custom fetch
function instead.
Details in original issue pnp/pnpjs#472 by @dannyfoncke.
Hi,
I installed pnp-auth v2.0.0 and @pnp/sp-commonjs v2.11.0 and I'm using them in my project in this way:
const bootstrap = require("pnp-auth").bootstrap;
const taxonomy = import("@pnp/sp-commonjs/taxonomy/index.js");
let url = settings.sharepoint365.url;
bootstrap(taxonomy, {
username: settings.sharepoint.auth.username,
password: settings.sharepoint.auth.password },
url);
But I send my request, I get this error:
C:\my-project\node_modules\pnp-auth\lib\index.js:17
sp.setup({
^
TypeError: sp.setup is not a function
at bootstrap (C:\my-project\node_modules\pnp-auth\lib\index.js:17:8)
...
..., etc.
Am I doing anything wrong or is this a bug?
Thank you.
Hi,
I am getting this error while compiling my project.
Module not found: Error: Can't resolve 'readline' in './node_modules/node-sp-auth-config/node_modules/inquirer/lib/ui/baseUI.js'
I am using Create React app using this https://create-react-app.dev then followed this stackoverflow to add pnpjs to connect to my on prem sharepoint 2013 site
https://sharepoint.stackexchange.com/questions/246264/pnpjs-with-on-prem-sharepoint
It looks like pnp-auth uses node-sp-suth-config as dependecy and node-sp-suth-config as dependecy uses inquirer.js. Hovering on var readline = require('readline');
, it takes me to
TypeScript\3.6\node_modules@types\node
Now, I m wondering problem in the version of typescript. Please someone help me to the resolve this issues.
My packages:
"dependencies": {
"@pnp/common": "^1.3.5",
"@pnp/graph": "^1.3.5",
"@pnp/logging": "^1.3.5",
"@pnp/nodejs": "^1.3.5",
"@pnp/odata": "^1.3.5",
"@pnp/sp": "^1.3.5",
"@types/jest": "24.0.18",
"@types/node": "12.7.4",
"@types/react": "16.9.2",
"@types/react-dom": "16.9.0",
"fetch": "^1.1.0",
"office-ui-fabric-react": "^7.31.1",
"pnp-auth": "0.0.4",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react-scripts": "3.1.1",
"typescript": "3.6"
},
node version: v8.11.1
npm version: v5.6.0
Thank you !
Hello Guys,
i recently came up with the Problem that i couldnt compile my project.
The following error came up
So i looked into your code and saw that your tsconfig.json was compiling to "es6".
To remove the Error i changed "es6" to "es5" and i had to add the option "lib": ["es2015"]
The new tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"sourceMap": true,
"declaration": true,
"moduleResolution": "node",
"noImplicitAny": true,
"removeComments": true,
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noStrictGenericChecks": true,
"skipLibCheck": true,
"outDir": "./lib",
"lib": ["es2015"]
},
"include": [
"src/**/*.ts"
]
}
I also added some dependencies to the package.json
but i guess it will work without them.
Just if it matters here are the libraries i came up with:
"dependencies": {
"@pnp/common": "^1.3.11", (new)
"@pnp/logging": "^2.0.4", (new)
"@pnp/odata": "^2.0.4", (new)
"@pnp/sp": "^2.0.4", (new)
"@pnp/sp-commonjs": "^2.0.4", (new)
"node-fetch": "^2.2.0",
"node-sp-auth": "^2.5.5",
"node-sp-auth-config": "^2.5.6"
}
Im not a pro at coding but i hope the changes help you.
Wish you the best, nice project!
This package is awesome. Thanks for your work on this, it made it so easy to drop @pnp/sp into node.js. I have a need to do the same thing with @pnp/sp-taxonomy. I'm thinking about forking and adding that capability, but am wondering if anyone else would see the benefit.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.