Closed dinogit closed 7 years ago
Hi there @dinogit,
Can you try using relative URLs starting with '/'? E.g. '/_api/web' not '_api/web'.
Hi @koltyakov
tried that first, it didn't work
How can I check if authentication succeeded?
I've just checked _api
and /_api
both works for me, I even forgot that this was taken into account. =)
You can check if auth works by creating authCheck.js
in project's root folder with:
const AuthConfig = require('node-sp-auth-config').AuthConfig;
const spauth = require('node-sp-auth');
const authConfig = new AuthConfig({
configPath: './config/private.json'
});
authConfig.getContext()
.then(context => {
return spauth.getAuth(context.siteUrl, context.authOptions);
})
.then(options => {
console.log(options);
})
.catch(error => {
console.log(error);
});
and running:
node ./authCheck
If auth is ok, then there should be something like this:
or an error if something wrong with the creds or network or something. E.g.:
What auth type are you using, what is the version of SharePoint? I can see that it's on-premises, some auth could have been provided wrong.
hm... got same message
sp-rest-proxy master ✗ 4d ◒ ➜ node ./authCheck
TypeError: callback is not a function
at Object.parseType2Message (/Users/dino/Sites/sp-rest-proxy/node_modules/httpntlm/ntlm.js:116:3)
at request.then (/Users/dino/Sites/sp-rest-proxy/node_modules/node-sp-auth/lib/src/auth/resolvers/OnpremiseUserCredentials.js:36:33)
at tryCatcher (/Users/dino/Sites/sp-rest-proxy/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/dino/Sites/sp-rest-proxy/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/Users/dino/Sites/sp-rest-proxy/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/Users/dino/Sites/sp-rest-proxy/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/Users/dino/Sites/sp-rest-proxy/node_modules/bluebird/js/release/promise.js:693:18)
at Async._drainQueue (/Users/dino/Sites/sp-rest-proxy/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/Users/dino/Sites/sp-rest-proxy/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/Users/dino/Sites/sp-rest-proxy/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:781:20)
at tryOnImmediate (timers.js:743:5)
at processImmediate [as _immediateCallback] (timers.js:714:5)
It Sharepoint 2013, authentication is handled by Forefront TMG
Hmm, I'm not sure that node-sp-auth
(authentication module) works with TMG.
What a coincidence! I was going to test it with TMG upcoming days on one of the projects and environment access to which I do not have yet.
@dinogit, could you please try On-Demand and FBA scenarios? To do it, just rename ./config/private.json
to something else and run the proxy or authCheck again and chose these strategies:
FBA is likely won't work (it would be crazy, but please try it too). On-Demand auth should open a browser window in electron for input. On-Demand auth can't work with NTLM, but when using TMG... maybe there a tiny chance. =)
If nothing of these won't work, stay tuned!
@s-KaiNet, just wondering, have you ever had a chance to test node-sp-auth
with TMG? If none of existing auth scenarios don't work probably I'll create PR, as for my task I got a lot of work with environment behind TMG.
Hi @koltyakov
I have test it and it's not working, receiving sam error.
Thank you very much for your time tonight and looking forward to see progress with environment behind TMG.
The only option which might work is ondemand scenario.
At least it works for this configuration, so that's a big chance it will work for TMG.
@dinogit have you tried on-demand option?
@s-KaiNet, thanks! We will know it for sure tomorrow when I got to get my hands dirty with TMG on the project I mentioned above.
hi @s-KaiNet , when using on-demand option, after successful login and hitting submit button, it displays "Loading..." and just stays like that. There are no errors in console.
Where does it display loading? Can you please post a screen?
Hey guys,
I've figured out and implemented new auth strategy for SharePoint (or actually any website) behind Forefront TMG reverse proxy.
Created a PR https://github.com/s-KaiNet/node-sp-auth/pull/17 to node-sp-auth
project, hope the merge process will be smooth.
Hey @dinogit,
Can you try newly added auth scenario for SharePoint behind TMG?
To do it you should update node-sp-auth
and node-sp-auth-config
by:
Deleting node_modules
folder and yarn.lock
or package-lock.json
(to avoid possible packages collisions),
and running
npm i node-sp-auth node-sp-auth-config --save-dev
inside a project.
Or it's even better to install sp-rest-proxy 2.4.0 - it contains updated dependencies.
Then delete or rename ./config/private.json
, run node ./authCheck
and choose Forefront TMG authentication
:
Auth cookie should be in the following format:
I was managed to run few tests with proxy and a new auth method on the environment I have. Everything worked for me. Hope the same on your end. =)
Hi @koltyakov
It's working 🥇 Thank you very much, you are the awesome
It's an issue in @types/request-promise
declarations, just can be ignored.
Hi @koltyakov I have updated yarn and it's working
Hi,
I have problem when trying to get request from Sharepoint. I did git clone project, built it, serve it and added credentials. After that I get this :
Error point to script.js:58.
Thanks in advance and thanks for creating this plugin.