NetSuite RESTlet OAuth 2.0 Authentication

I have some custom RESTlets in my NetSuite account that I am calling within flows. These are currently configured as a REST API connection using credentials in the authorization header (NLAuth). As of the 2021.1 release, this method of authentication will no longer be supported. I am attempting to configure this to use OAuth 2.0 instead (using the HTTP connection type). The authorization step seems to work, but fails when requesting the token from NetSuite with either an unexpected error or an "invalid_grant" error.

Based on my trial and error with this configuration and reading NetSuite documentation, I believe that a custom request body is required for the token request. I've tried configuring this, but I can't figure out how to refer to the code value returned in the authentication step or verify that I am sending correct information in the request.

I'm just wondering if anybody has successfully configured OAuth 2.0 authentication for RESTlets and could share any information on how this is configured. Any tips would be greatly appreciated. Thanks!

Hi @michaelkrueger,

Sorry for the delay in this response and that you're running into this issue. This is very helpful information that we should add to our documentation, so I'm looking into this. So that we can get this resolved for you more quickly, could you open a support ticket on this?

Hi Courtney, thank you for the response. I actually did open a ticket with support. The direction I was given from product development is that OAuth 2.0 is not advised as the method of authentication for custom RESTlets. Instead, the solution proposed was to create an HTTP connection to make a call to the integrator.io API to utilize my existing connection to NetSuite (i.e. using the built-in NetSuite connection type). When this API call is made, we are able to specify the script and deployment ID of our custom RESTlet and leverage the authentication mechanism used by the built-in NetSuite connector when calling the integrator.io RESTlet in our account.

I've configured this solution and it does seem to work. I wish there were a little more "direct" method to configure this type of connection. Perhaps a connector specifically for calling custom RESTlets could be added to the product to simplify the configuration of such a connection. That being said, if this is the recommended approach, it would be nice if there was a documented solution for how to configure this. Others many run into this same question in the future, especially after the 2021.1 release when token-based authentication will be the only allowed method of authentication for RESTlets.

Thank you again for the follow up!

Would it be possible to share how this was done? I have the same requirement.
Thank you,
Joirge Iriarte

@jorgeiriarte
Hi Joirge,
I talked to the support representative who worked on @michaelkrueger's case above and he recommends you work directly with Support on this configuration.

Thanks!

FYI the RESTlet via proxy approach doesn't seem to support passing any parameters to the RESTlet. If this is true, it isn't really a solution for many cases.