Making OAuth work with NodeJS

Hi all,

I am looking for some support on making OAuth work for the web application I am developing. I am trying to use node JS, and I am loving all the documentation and support available for Smartsheet API stuff online. That being said, it seems to all be depreciated!!

CRUX: Most support is from 2018, and when I try to follow the same steps, I get error messages that go back to the modules not being up to date. The error message has been uploaded as a JPG. Any ideas where the fix is? Any ideas what else to try?

I did npm install, and npm install smartsheet. After I get warning messages I did npm audit fix. I've looking side the module folders and tried tweaking the language (changing 'request' to '../request'). Looking for some more insight!!


Best Answer

  • Dowbuilt Automation
    Answer ✓

    Final update--

    I got the OAuth to work through very simple fixes. I may have been using an out-of-date-resource because this time around when I typed "npm install" there was no warnings of depreciation. The main issue though, which is silly, was mis-implimentation of Node.JS. I had been in a development environment where I start a page up with "npm start", but for the OAuth flow I was writing Node.js code, which has a different start up script-- "node FILE_NAME.js start". When I utilized node with this node script (as opposed to npm script) it started listened to the URL of the website (localhost), and it all worked from there.

Answers

  • Genevieve P.
    Genevieve P. Employee Admin

    Hi @Dowbuilt Automation

    Were you able to get this working? Our API Documentation was recently updated, here is the updated OAuth Walkthrough using OAuth 2.0: https://smartsheet.redoc.ly/#section/OAuth-Walkthrough

    If you've gone through the steps in this updated documentation, it would be helpful to know at exactly what stage you're receiving the error. You may also want to reach out to Smartsheet Support (here), so that you can provide them with screen captures and work with them in a private channel.

    Cheers,

    Genevieve

  • Dowbuilt Automation
    edited 07/07/21

    Genevieve,

    Thanks for your response!

    I never got it working :( and I will need to get it working before my app will be production-ready. That being said, after my attempts I documented/posted my error and pivoted to other aspects of the project where I have greater momentum. In the coming weeks I will be returning to this topic and I will check out those resources and also maybe reach out at the url linked in your comment. I can also post, on this thread, my solution once I arrive to one.

    I appreciate the warm support!

    Ariel

  • Genevieve P.
    Genevieve P. Employee Admin

    Hi Ariel,

    Thank you for this update! 🙂

  • Dowbuilt Automation
    Answer ✓

    Final update--

    I got the OAuth to work through very simple fixes. I may have been using an out-of-date-resource because this time around when I typed "npm install" there was no warnings of depreciation. The main issue though, which is silly, was mis-implimentation of Node.JS. I had been in a development environment where I start a page up with "npm start", but for the OAuth flow I was writing Node.js code, which has a different start up script-- "node FILE_NAME.js start". When I utilized node with this node script (as opposed to npm script) it started listened to the URL of the website (localhost), and it all worked from there.

  • Genevieve P.
    Genevieve P. Employee Admin

    Amazing! Thanks for this final update, I'm glad to hear you got it working and I'm sure your solution will help clarify how to set this up for someone else. I really appreciate you following up on this post, thank you.

    Cheers,

    Genevieve