Forum Discussion

SuryaReddy's avatar
SuryaReddy
New Contributor
7 years ago

SOAP Session Token Create - How to send encrypted Credentials

I am using SOAP Execute to call a SOAP webservice Operation which generates a session token to be used in subsequent calls.
The webservice requests Username, password and APIKey - I can setup a mapper and pass these parameters as clear text, but I am assuming that there is a better way of doing this where these details are encrypted and not visible as clear text to other programmers/users. Can you please advise what the right way to go about this?

2 Replies

  • robin's avatar
    robin
    Former Employee

    Netsuite + OAuth 2.0

    @johnnys I created an Integration in Netsuite (Setup > Integration > Manage Integrations), enabled REST Web Services and Auth Code Grant under OAuth section and entered in the SnapLogic REST Callback URL (https://elastic.snaplogic.com/api/1/rest/admin/oauth2callback/rest). I copied the generated key and secret also - creation is the only time these are displayed:

    You must also enable REST Web Services and OAuth 2.0 as Features (Setup > Company > Enable Features)

    In the REST POST Snap, create an OAuth 2.0 account, enter in the key and secret you copied earlier as Client ID and Client Secret.

    I enabled Header Authentication.

    For “OAuth2 Endpoint” I used https://<ACCOUNT_ID>.app.netsuite.com/app/login/oauth2/authorize.nl as per the Netsuite documentation.

    For “OAuth2 Token” I used https://<ACCOUNT_ID>.suitetalk.api.netsuite.com/services/rest/auth/oauth2/v1/token

    Grant Type is authorization_code and the Auth Endpoing config table had a single entry scope whose value should match the Scope section from earlier (in my case that was restlets,rest_webservices,suite_analytics).

    Authorizing the account was successful and returned an access token and expiration (consider enabling Auto-refresh token also)

    Then in the REST POST configuration, I tried to replicate your use case (SuiteQL):

    Service URL = https://<my-account-id>.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql
    HTTP Entity = {"q":"SELECT 'Hello world!' AS Greeting FROM DUAL"} (taken from a SuiteQL tutorial)

    Lastly, the SuiteQL API requires a request HTTP header Prefer. I used a value of transient which I was on the tutorial above:

    After configuring the Snap to Validate & Execute, a validation run successfully returned the JSON response from the Netsuite SuiteQL API:

  • Hi. I’m really not sure why our REST snap’s OAuth 1 account type is requiring so many things that Postman does not (the Endpoints), and not allowing you to enter some of the values that you do need to specify (the Token and Token Secret). I’m unfamiliar with our REST OAuth1 account type. It seems to be designed for some other OAuth 1 use case for a different SAS.

    Let me ask this: Are you trying to call a NetSuite RESTlet or are you trying to call NetSuite’s REST API? They are different. We have a new NetSuite RESTlet snap that can be used for RESTlets, but we don’t yet have direct support in our NetSuite snap pack for calling the NetSuite REST API. It’s planned for a future release.

    • johnnys's avatar
      johnnys
      New Contributor

      Is it possible to setup a call to discuss this and what my options are to accomplish this request?

      Thanks,

      Johnny

      • ptaylor's avatar
        ptaylor
        Employee

        Hi Johnny. I think you may not have any great options for calling the SuiteQL API via REST with our snaps in the short term with the current limitations of our REST OAuth1 account type. I have learned that this account type was designed around a particular way of using OAuth1 for a particular SAS but it’s clearly not going to work with NetSuite.

        Until we address this (which is not on our roadmap currently as far as I know), your other options involve our NetSuite snap pack:

        • Write a NetSuite RESTlet that does what you need. That’s a script that you write and install in your NetSuite account. You would then use our new NetSuite Call RESTlet snap to call it from a pipeline, and it executes on the NetSuite server. The script can access a variety of NetSuite server-side APIs to access your data. Our snap handles the complexity of NetSuite’s OAuth1 authentication. This is a new snap that will be included in our May release, but is also available now as a patch for our Feb release. We have two customers using it.

        • See if our other NetSuite snaps might do what you need. They use NetSuite’s SOAP-based SuiteTalk API. Many of our customers have found these sufficient for their needs.

        We are planning on eventually providing more direct support in our NetSuite snap pack for NetSuite’s newer REST-based APIs (apart from RESTlets). These APIs are new in the past year, I believe.

        Hope that helps.

  • robin's avatar
    robin
    Former Employee

    @johnnys this can be achieved with the REST Snap Pack and a Netsuite OAuth 2.0 account. I’ll write up instructions for this in the coming days.