Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Andrew Koltyakov
    @koltyakov
    Some things are just not feasible client-side due browsers security limitations.
    AnotherGenericJim
    @AnotherGenericJim
    Hey Andrew I tried your proxy thing on my work server and it connected through NTLM
    So my next question is do I now just call local host 8080 in one visual studio code browser and have a separate react one that fetches local host 8080?
    AnotherGenericJim
    @AnotherGenericJim
    If I use your nifty page set up that changes the link would that pull through to react
    Andrew Koltyakov
    @koltyakov
    It's not about the browser. What is used to serve React app locally, Webpack Dev Server? If a local web server supports API proxying it should be provided with a URL for the API endpoint (it's described in details in the mentined article). If a local web server doesn't support API proxying, in the client side application the requests should be routed correspondenly (when localhost, use proxy's address but not the same as the app is hosted on).
    Ahmad Ali Saeed
    @ahmadali_saeed_twitter
    that's what electron solves and allows us to connect remote service
    Andrew Koltyakov
    @koltyakov
    What's the connection with Electron? The question was about local development toolchain. With Electron, yep, you can use its backend (Node.js) process and node-sp-auth with a correct auth strategy. No nuances here.
    AnotherGenericJim
    @AnotherGenericJim
    Andrew I have it working and it solved my issue with local host. Thanks so much for making this as it is making development 100 times easier for me. Great job on a solid tool!
    Andrew Koltyakov
    @koltyakov
    Thanks @AnotherGenericJim! Glad it works for you.
    himyulian
    @himyulian
    Hello everyone, I'm sorry, I do not know if I can ask about PnPjs here?
    Andrew Koltyakov
    @koltyakov
    It's better asking here https://gitter.im/OfficeDev/PnP-JS-Core yet in this lobby many knows PnPjs as well.
    himyulian
    @himyulian

    I'm trying connect to SharePoint 2013 from Node

    import { sp } from "@pnp/sp";
    import { SPFetchClient } from "@pnp/nodejs";
    sp.setup({
        sp: {
            fetchClientFactory: () => {
                return new SPFetchClient("{site url}", "{client id}", "{client secret}");
            },
        },
    });
    sp.web.select("Title", "Description").get().then(w => {
        console.log(JSON.stringify(w, null, 4));
    });

    But i've got 401 Unauthorized

    Please help me understand the reason of the error.
    Response headers:
    изображение.png
    Request headers:
    изображение.png

    Andrew Koltyakov
    @koltyakov
    Answered you in another tread as well, SPFetchClient's AddIn-Only permissions works for SPO, not On-Prem. For onprem pnp-auth is a auth library of choice https://github.com/SharePoint-NodeJS/pnp-auth#manual-bootstrap
    Andrew Koltyakov
    @koltyakov
    @himyulian, I recalled you asked related question in node-sp-auth-config repository. This toolchain is for Node.js and can not be bundled as a frontend code and what more, can not work on frontend client-side in most of the situations and for 100% for OnPrem. Can you you describe your use case that you try implementing. I have a feeling that you try developing a webpart/client-side app (using Vue) locally in its dev web server and consuming SharePoint API during development. But after an app is built it will be deployed to SharePoint page? Am I right in this assumption? If it's true, another approach should work for you - https://github.com/koltyakov/sp-rest-proxy - and some details on React example which should not be complicated to reuse in Vue toolchain as well.
    himyulian
    @himyulian
    @koltyakov yes, this App for work in the browser as a client-side app (not webpart) using Vue.
    And after an app is built it will be deployed to SharePoint page
    himyulian
    @himyulian
    @koltyakov thanks for the tip, I will try to follow your recommendation
    peni4142
    @peni4142
    I have a problem with spsave. I can't transpile it. (tsc --version Version 3.3.3333, "spsave": "^3.1.5"). Transpile error:
    node_modules/@types/request-promise/index.d.ts:26:49 - error TS2694: Namespace 'request' has no exported member 'Response'.
    Is there a trick?
    That is my typescript code:
    import { spsave } from "spsave";
    console.log(spsave.name);
    //Just to test it
    peni4142
    @peni4142
    and i have to use a tsconfig.json (but i could leave it empty)
    tsc -b ./tsconfig.json
    Andrew Koltyakov
    @koltyakov
    Hi @peni4142,
    Did you try adding "skipLibCheck": true option to compilerOptions in tsconfig.json?
    peni4142
    @peni4142

    @koltyakov
    tsconfig.json:10:3 - error TS5023: Unknown compiler option 'skipLibcheck'.

    10 "skipLibcheck": true,
    ~~~~~~
    hmm...

    oh moment
    yeah works, but I don't get that property suggested...
    @koltyakov thanks for help
    himyulian
    @himyulian
    @koltyakov Hi!
    I have a question about sp-rest-proxy
    In our company, authorization with SP2013 is implemented on Kerberos.
    Unfortunately, I didn’t find a suitable type of authorization from the options offered when forming the file privat.json
    Can you help please?
    Andrew Koltyakov
    @koltyakov
    Hi @himyulian, unfortunately, Kerberos is not a supported option in node-sp-auth (authentication library behind the magic).
    himyulian
    @himyulian
    @koltyakov It's a pity. As far as I understand, there are no other ways to connect with SP2013 in the environment of the Node.js?
    Sergei Sergeev
    @s-KaiNet
    @himyulian the only option which might work for you is to extend your kerberos sharepoint web application to another url with ntlm auth enabled
    Andrew Koltyakov
    @koltyakov
    AddIn Only permissions can be configured (https://github.com/s-kainet/node-sp-auth/wiki/SharePoint-on-premise-addin-only-authentication) or the web app extended to another auth type support, NTLM.
    Hi @s-KaiNet!
    Sergei Sergeev
    @s-KaiNet
    or form-based auth and give permissions only to certain users
    Andrew Koltyakov
    @koltyakov
    will On-Demand theoretically work with Kerberos?
    Sergei Sergeev
    @s-KaiNet
    nope(
    Hi @koltyakov :)
    himyulian
    @himyulian
    @s-KaiNet Unfortunately, NTLM authorization is prohibited by company policy.
    himyulian
    @himyulian
    @s-KaiNet Is it possible to add the authorization option by Kerberos to the node-sp-auth library?
    Sergei Sergeev
    @s-KaiNet
    as of now it's way too difficult - involves extend learning of Kerberos protocol and finding a way to implement it in nodejs
    himyulian
    @himyulian
    I see, thanks. And so it would be very good in the future to think about it.
    vaderj
    @vaderj

    So I am a little confused as I have been trying to accomplish this without success for months. Can node-sp-auth actually authenticate with the current users credentials WITHOUT being give the users credentials? The only time I can get node-sp-auth to work is either saving the credentials to the disk or typing them in directly. A working example of the behavior I am trying to achieve is accomplished (in SQL) with the "msnodesqlv8" module (it specifically appears to use Windows ODBC but I could be mistake, which is obviously not an option for SharePoint, I am just using this as an example of the behavior I am trying to get).

    Has anyone been able to have node-sp-auth using the current user authentication without storing the credentials? Thanks!

    Sergei Sergeev
    @s-KaiNet
    @vaderj as an author, I can say it's not possible. node-sp-auth uses pure javascript without C++ modules, thus behavior you want isn't available
    consider also https://github.com/koltyakov/node-sp-auth-config for file configs. It adds a bit of encryption and allows no to store passwords in clear text
    however, it's not pure encryption
    vaderj
    @vaderj
    thanks @s-KaiNet !
    Prince PY
    @princeppy
    Hi When I add node-sp-auth on to a plain fresh create-react-app of node version 8.11.4. on start i am getting error from 'inquirer' enquire module that one file ('readline') cannot be resolved. I tried to change the correct reference, but something else broke. can some one help me.
    My aim is to create a react app to get sharepoint url, username and password from user and check for a specific list in that sharepoint site. with out storing username and password for the user.
    Sergei Sergeev
    @s-KaiNet
    @princeppy you can't use node-sp-auth in browser, such kind of scenarios are not supported
    however checkout this great article on a possible scenario for react app with sharepoint proxy - https://www.linkedin.com/pulse/local-spfx-workbench-against-real-sharepoint-api-andrew-koltyakov/
    ellonimo
    @ellonimo_twitter

    Hi. Could you please help me make sp-rest-proxy correctly work with batching? It drives me crazy...
    Let the example be https://pnp.github.io/pnpjs/sp/docs/items/#update-multiple-items. Proxy gets POST request with payload:

    --batch_b18ca450-d9dc-40c7-8855-b7de9a621369
    Content-Type: multipart/mixed; boundary="changeset_91eacb9d-a188-47d2-8b97-99f97271f926"
    
    --changeset_91eacb9d-a188-47d2-8b97-99f97271f926
    Content-Type: application/http
    Content-Transfer-Encoding: binary
    
    MERGE http://localhost:3000/sites/internalsites/Recruiting/_api/web/lists/getByTitle('rapidupdate')/items(1) HTTP/1.1
    accept: application/json; odata=verbose
    content-type: application/json;odata=verbose;charset=utf-8
    if-match: *
    x-clientservice-clienttag: PnPCoreJS:@pnp-1.2.8
    
    {"__metadata":{"type":"SP.Data.CustomListListItem"},"Title":"Batch 6"}
    
    --changeset_91eacb9d-a188-47d2-8b97-99f97271f926
    Content-Type: application/http
    Content-Transfer-Encoding: binary
    
    MERGE http://localhost:3000/sites/internalsites/Recruiting/_api/web/lists/getByTitle('rapidupdate')/items(2) HTTP/1.1
    accept: application/json; odata=verbose
    content-type: application/json;odata=verbose;charset=utf-8
    if-match: *
    x-clientservice-clienttag: PnPCoreJS:@pnp-1.2.8
    
    {"__metadata":{"type":"SP.Data.CustomListListItem"},"Title":"Batch 7"}
    
    --changeset_91eacb9d-a188-47d2-8b97-99f97271f926--
    
    --batch_b18ca450-d9dc-40c7-8855-b7de9a621369--

    but result is

    --batchresponse_c92f0856-7428-4f77-ba5e-a9c84f24bf68
    Content-Type: application/http
    Content-Transfer-Encoding: binary
    
    HTTP/1.1 400 Bad Request
    CONTENT-TYPE: application/json;odata=verbose;charset=utf-8
    
    {"error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"Invalid request."}}}
    --batchresponse_c92f0856-7428-4f77-ba5e-a9c84f24bf68
    Content-Type: application/http
    Content-Transfer-Encoding: binary
    
    HTTP/1.1 400 Bad Request
    CONTENT-TYPE: application/json;odata=verbose;charset=utf-8
    
    {"error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"Invalid request."}}}
    --batchresponse_c92f0856-7428-4f77-ba5e-a9c84f24bf68--

    If I deploy this code to dev SharePoint 2016 page it does updates without errors.
    sp-rest-proxy changes site name correctly: POST (batch): http://bss-ihome2016/sites/internalsites/Recruiting/_api/$batch
    I've red lots of articles, also this koltyakov/sp-rest-proxy#42 , but in my case it looks OK, but does not OK.

    Andrew Koltyakov
    @koltyakov
    Hi @ellonimo_twitter,
    Can you create an issue in sp-rest-proxy's repo? I'll take a look.
    Some details might be required. There is even integration test for batch update. So I assume it'll work for me.
    ellonimo
    @ellonimo_twitter
    Hi @koltyakov ,
    Thank you
    Andrew Koltyakov
    @koltyakov
    Actually, I've olready figured out, fixed, going to test more and publish an update.