by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    jjongman
    @jjongman
    @s-KaiNet Thanks! I didn't know about pnp-auth so will look into that
    Pulkit Goyal
    @pulkit110_twitter
    Hello everyone, I am trying to find a way to do unattended authentication using only a client id and secret to Sharepoint using Ruby. I know this is a node specific community, but was wondering if you someone has a link to a documentation describing steps to perform for unattended auth?
    Sergei Sergeev
    @s-KaiNet
    @pulkit110_twitter Hi, do you need it for SharePoint Online?
    Pulkit Goyal
    @pulkit110_twitter
    @s-KaiNet Yes, for SharePoint Online
    Sergei Sergeev
    @s-KaiNet

    you have two options
    one is to register new app in your organization's Azure AD, generate client id and client secret and use certificate based authentication in order to obtain oauth access token for sharepoint
    Microsoft has a library for Ruby - https://github.com/AzureAD/azure-activedirectory-library-for-ruby/tree/dev/samples/client_assertion_certificate_example (the sample in Ruby with certificate)
    some more info - https://stackoverflow.com/questions/50522044/is-it-possible-to-access-sharepoint-online-data-using-azure-ad-authentication
    NOTE: you can't use client credentials grant if you want to access SharePoint REST API in unattended scenario, only certificate based

    or you can register your app directly in SharePoint and use a series of HTTP calls to get your access token
    how to register an app in SharePoint - https://github.com/s-KaiNet/node-sp-auth/wiki/SharePoint-Online-addin-only-authentication#configuration-required
    for the actual code which generates access token I recommend you to take a look at this code - https://github.com/s-KaiNet/node-sp-auth/blob/master/src/auth/resolvers/OnlineAddinOnly.ts
    that's TypeScript, but I think it's pretty self-explanatory. This code generates access token using registered SharePoint client id and secret. There are no any official documents on how to do that(

    once you have access token you can call SharePoint REST API

    Pulkit Goyal
    @pulkit110_twitter
    Thanks a lot. The second option was exactly what I was looking for. I was hoping there were some official docs for this process, but I can dig into the code. Thanks again
    Jorge Sepulveda
    @jorluiseptor
    Hello. I have a noob question. I just started using sp-rest-proxy. I have my local dev running on localhost:3000 and the proxy on localhost:3001. I still get a 403. The proxy is supposed to run on a separate port, right?
    Sergei Sergeev
    @s-KaiNet
    right
    do you see any other errors in console?
    Jorge Sepulveda
    @jorluiseptor
    the proxy by itself works fine, e.g. if i copy an api url, i get data. but the homepage gives me an error: Error: ENOENT: no such file or directory, open 'C:\Users\jorlu\Projects\StaffAvailibilityTool\sat.ux\static\index.html'
    in the console i get: GET http://localhost:3001/_api/web/getuserbyid(10) 403 (Forbidden)
    Sergei Sergeev
    @s-KaiNet
    try to run your proxy on https, I use below code to run it on https with the save certificated used by SPFx:
    const CertStore = require('@microsoft/gulp-core-build-serve/lib/CertificateStore');
    const RestProxy = require('sp-rest-proxy');
    
    const CertificateStore = CertStore.CertificateStore || CertificateStore.default;
    
    const settings = {
      configPath: './config/private.json',
      port: 4323,
      protocol: 'https',
      ssl: {
        cert: CertificateStore.instance.certificateData,
        key: CertificateStore.instance.keyData
      }
    };
    
    const restProxy = new RestProxy(settings);
    restProxy.serve();
    to make it work you should have SPFx solution installed in your folder with proxy.js file
    Jorge Sepulveda
    @jorluiseptor
    got it. let me take a look
    Jorge Sepulveda
    @jorluiseptor
    thank, @s-KaiNet . That was the issue. I needed to create a local https. ty for your time.
    Danny Foncke
    @dannyfoncke

    hi
    New here, so excuse if I tackle asking this question the wrong way

    I have a node js app running on a server that connects to SharePoint using adfs (node-sp-auth)
    Works like a charm

    Porting this app to a new env, the admins of that env tell me to 'include the (url of the) identity provider to be used for authentication' ....

    Right. ??

    Don't know if my question makes sense, but all help is greatly appreciated

    Sergei Sergeev
    @s-KaiNet
    tbh I don't have an idea what they are asking :)
    if you can ask them to explain, it might be helpful
    Danny Foncke
    @dannyfoncke

    When I go to a SP site via the browser I get a (logon) screen, which asks me to choose the place (identity provider ?) where my credentials are kept.
    After choosing that I can give my credentials
    My node app has no knowledge of this 'choosing an identity provider' so the authentication fails ? because the receiving end does not know where to validate ?
    Hence the admins ask me to 'include the identity provider in my call

    That's what I make of it anyway

    I found passport-saml ....
    Danny Foncke
    @dannyfoncke
    looks way more complicated
    Sergei Sergeev
    @s-KaiNet
    if one of those identity providers is adfs provider, then it should just work. The only thing is that you should correctly setup credentials options for adfs (like relyingParty, etc)
    Denis Molodtsov
    @Zerg00s
    hi there, does anyone know if it's possible to run o365 cli from inside a gulp task? Sorry if it's a wrong place for a question like that
    Andrew Koltyakov
    @koltyakov
    Hi @Zerg00s you can literally run any non interactive command line tool in Node.js and Gulp tasks in particular. There are some nuances as usual but totally feasible. For Gulp, take a look at this library https://www.npmjs.com/package/gulp-shell, hope this will help.
    Andrew Koltyakov
    @koltyakov
    Didn’t try O365 CLI as a library (use it only as a CLI), however, it should also be possible reusing some parts by importing them into a Node.js project too. Interesting idea to check.
    Denis Molodtsov
    @Zerg00s
    Thank you @koltyakov (Andrew) Looks like exactly what I was looking for
    Tim Parsons
    @timmparsons
    Hi All, I'm new to sharepoint and am wondering how I go about posting to a list from data i'm receiving in a webhook?
    Andrew Koltyakov
    @koltyakov
    Hi @timmparsons, webhooks return only context metadata and change token. Using change token and request to getlistitemchangessincetoken API endpoint (see more: https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/synchronize-sharepoint-items-using-the-rest-service) the actual changes can be recived.
    There is a variety of ways to consume SP API: PnPjs, sp-request, raw fetch + node-sp-auth powered, to name just a few.
    AnotherGenericJim
    @AnotherGenericJim
    Hey everyone I am in an odd situation where I am on a SP 2013 on premise install with no app model turned on. I was hoping the node-sp-auth library might help with getting authorization for cross domain calls for localhost 3000 (not sure if it can accomplish this or not) as part of a react project in vs code. That being said I am also getting odd issues when I install that library. For instance it says readline is missing and when I try and change the path it then throws path binding errors. Was anyone able to get this library to work? If so will it solve for what I am attempting to do?
    this is the library I am referring to : https://www.npmjs.com/package/node-sp-auth
    Sergei Sergeev
    @s-KaiNet
    node-sp-auth is a module for nodejs, it can't be used in react application
    AnotherGenericJim
    @AnotherGenericJim
    I see
    I am pretty new to this whole js programming thing Sergei so I apologize if this dumb question. Isnt NodeJS just a bunch of libraries? What prevents it from being used with a react app? Again this is probably just an ignorance issue on my part. Thanks for being so quick to reply to my question.
    Sergei Sergeev
    @s-KaiNet
    no worries, that's the reason we have this chat - for the whole range of questions
    nodejs is an "environment" to run javascript on a server (i.e. in your operation system process), like .NET but for javascript
    when you run react app, it runs inside your browser, which is different from nodejs
    node-sp-auth uses some things from the underlying operation system, thus making it impossible to run in-browser (in react app for example)
    AnotherGenericJim
    @AnotherGenericJim
    Got it and a big thank you for the explanation. So what would I do to send a simple fetch call to Sharepoint 2013 with regards to cross domain rest calls? I saw that it uses a cookies to help with authentication but I am unsure how to approach grabbing it. I have tried just username, password, and domain in headers and that doesn't seem to get be passed a simple 401 and the no cross domain error. If you had a minute how would you potentially approach a scenario like this one? Again, I truly appreciate your insight and help.
    that get me passed not get be passed. Sorry about the typo.
    Sergei Sergeev
    @s-KaiNet
    just to be clear - you want to access SharePoint via rest api from your app running at localhost:3000, correct?
    AnotherGenericJim
    @AnotherGenericJim
    Yes Sergei that is what I am attempting.
    Sergei Sergeev
    @s-KaiNet

    tbh that's not a trivial question, it depends on type of authentication used by your SharePoint instance you're trying to reach out
    one option would be implementing the same type of authentication in your app, then enabling cors in SharePoint 2013 to be able to send cors request from one domain (your app) to SharePoint
    another option use server-side code with any kind of authentication (username and password) and perform all kind of operation from server
    the last option is provider-hosted app

    you can try to post your question on a forum https://sharepoint.stackexchange.com or https://techcommunity.microsoft.com/t5/SharePoint/bd-p/SharePoint_General

    AnotherGenericJim
    @AnotherGenericJim
    Ok I appreciate the help Sergei. Thanks!
    Andrew Koltyakov
    @koltyakov
    @AnotherGenericJim, localhost:3000 - so it's only during development time in CRA serve mode?
    did you try sp-rest-proxy? a bit old article yet shows the idea https://www.linkedin.com/pulse/getting-started-react-local-development-sharepoint-andrew-koltyakov/
    AnotherGenericJim
    @AnotherGenericJim
    Andrew Thanks for sharing I will on board that and give it a try. Appreciate you sharing.
    peni4142
    @peni4142
    Hi this is my second try for Gitter :) I using spsave for uploading to Sharepoint (O365). It returns Statuscode Error 500 (Internal Server Error). Does spsave create folders, if they don't exists?
    peni4142
    @peni4142
    Ok folder seems not to be the problem at all. Tried to upload into an existing folder
    peni4142
    @peni4142
    I getting following error: "500 - {"error":{"code":"-1, Microsoft.SharePoint.Client.UnknownError","message":{"lang":"de-DE","value":"Unbekannter Fehler."}}}", but I have no idea why
    Sergei Sergeev
    @s-KaiNet
    @peni4142 which kind of authentication do you use? username and password?
    I would suggest trying client id and client secret (aka add-in auth)
    use this wiki page to find out how to configure it https://github.com/s-KaiNet/node-sp-auth/wiki/SharePoint-Online-addin-only-authentication
    peni4142
    @peni4142
    using username and password at the moment.
    but maybe I have a problem with sharepoint, what is site, what is a folder. I am very new to sharepoint :D