Hi Everyone, Where do I go to generate an access k...
# general
k
Hi Everyone, Where do I go to generate an access key (no expiration) from Netsuite for my server?
k
Hi Battk thank you
If I want to do a localhost server to read and write data to my netsuite SB, where can I place the given access token client ID and secret to?
b
honestly this is an unusual question
usually you at least know your choices for integration method before doing authentication
k
Currently, I want to build a web service that will link between 2 platform. I do not have a clue how to read or write data in netsuite
Thank you for the documentation on the 3 different integration.
Is this a way you would say it’s correct ? I create a restlet script My nodejs server then make a rest call to that script, Then that script will do what ever I coded it to do, given the body information by my nodejs server or it can be empty.
However I still don’t understand how I can automatically gain access to the Auth token so my nodeJS server can gain access. All i understand is the auth2.0 grant type but that access gain is manual. Is there a way to gain the access token automatically?
b
restlet is fine, but generally suitescript requires more specialized knowledge about netsuite
you will need to write both the client (your node server) and the server (the restlet)
k
I see, I understand. So, basically my node server will gather information (other web server) and call the restlet. Then compares data or do what ever it needs to do then make another restlet call (another different restlet script) to make changes to netsuite?
b
your choice, you are writing the restlet, you can make it do whatever you want
k
Understood thank you, Currently I am doing testing but only trouble i have is automatically get the access token from Netsuite.
b
netsuite implements 2 grant types for oauth 2: authorization code and client credentials
k
Currently I am using authorization _code , havne’t looked into client credentials
b
authorization code is designed to allow a user to manually grant access to their netsuite account
netsuite's implementation is basically a 7 day temporary grant, which is inconvenient to the point of useless
k
Will I be able to refresh those token via refresh token?
b
your refresh token is valid for 7 days
access tokens valid for an hour
k
I see
b
the other oauth 2 alternative is client credentials, which is so new that the documentation is still wrong
it however is designed so that you dont need a user to use their browser to grant access every 7 days
k
I see
b
which is mostly oauth 1
k
I followed the step and I have the auth1.0 ID and secret. However where can I place these values? If header, what parameter?
Im looking into the auth1.0 doc by Auth0, It sends a data option
Copy code
var options = {
  method: 'POST',
  url: '<https://youraccount.auth0.com/api/v2/connections>',
  headers: {authorization: 'Bearer ABCD'},
  data: '{ "name": "digitalocean", "strategy": "oauth2", "options": { "client_id", "YOUR-DIGITAL-OCEAN-CLIENT-ID", "client_secret": "YOUR-DIGITAL-OCEAN-CLIENT-SECRET", "authorizationURL": "<https://cloud.digitalocean.com/v1/oauth/authorize>", "tokenURL": "<https://cloud.digitalocean.com/v1/oauth/token>", "scope": ["read"], "scripts": { "fetchUserProfile": "function(accessToken, ctx, cb) { request.get(\'<https://api.digitalocean.com/v2/account>\', { headers: { \'Authorization\': \'Bearer \' + accessToken } }, function(e, r, b) { if (e) return cb(e); if (r.statusCode !== 200 ) return cb(new Error(\'StatusCode: \' + r.statusCode)); var profile = JSON.parse(b).account; profile.user_id = profile.uuid; cb(null, profile); });}'
};
Will Netsuite use the same parameter?
b
no, that doesnt even look like oauth 1
k
hmm
b
you will probably have to read all the documentation on Token-based Authentication
especially the section on Token-based Authentication and RESTlets
k
ok, let me look into it and get back to you, Thanks for all the help
Hi battk, So, I have my consumer key, secret, and access token and token secret. I ran a request to netsuite’s restlet but I am getting Invalid_Login_Attempt
I have “Token-Based Auth” and “TBA:issueToken” both check
I am following this guide, however I am using admin role
b
boring answer will be once again to go through the entire section on the TBA in the help
k
Got it
it works