Error : Machine-to-machine authentication is not a...
# sdf
s
Error : Machine-to-machine authentication is not allowed for the current execution context. I am getting this error when im trying to authenticate using node cli commands in the mac terminal This is sdf cmd ive used :
suitecloud account:setup:ci --authid SB3_M2M --certificateid ouoVREScQPsGq-fsdfhodsofnvosdnvo --privatekeypath "/Users/shreesashti.lk/Documents/SDF/Authentication Files/SB3" --account 3822968_SB3
Kindly help me authenticate using M2M using node cli
j
you have the
SUITECLOUD_CI
and
SUITECLOUD_CI_PASSKEY
environment variables set? https://system.netsuite.com/app/help/helpcenter.nl?fid=article_0113125121.html
s
Hi Jonathan ,. thanks for pointing that out . I tried with the same . this time i got this error :
The following environment variables are currently set: SUITECLOUD_CI, SUITECLOUD_CI_PASSKEY
The operation you are trying to perform is not allowed with the current environment variable configuration.
For more information, see <https://system.netsuite.com/app/help/helpcenter.nl?fid=article_0113125121.html>.
Ive set SUITECLOUD_CI_PASSKEY=qwertyuiopasdfghjklzxcvbn1234567890; SUITECLOUD_CI =1
m
Maybe you need to export those vars like this export SUITECLOUD_CI_PASSKEY=qwertyuiopasdfghjklzxcvbn1234567890; export SUITECLOUD_CI =1
j
is the "operation you are trying to perform" the same? browser-based authentication (ie
account:setup
) won't work while those environment variables are set, only machine-to-machine (
account:setup:ci
)
s
Yes i tried with accountsetupci and set the evironment variables as suggested here. now i able to bypass the error . Thanks @Jonathan MacKenzie, @Marcos Lopez
Now i m stuck this :
There was an error with the private key used to authenticate. Verify the contents of the private key.
when i create a EC cert and
There was an error with the certificate ID used to authenticate.
when i used a RSA cert . but my certs are active (not revoked). What am i missing here. steps i followed : 1. created sdf dev role and assigned to the user 2. created integration record with Client Credentials (Machine To Machine) Grant checked along with scope 3. generated .pem public and private keys using the https://3822968-sb3.app.netsuite.com/app/help/helpcenter.nl?fid=section_162686838198.html cmds 4. Uploaded the public key and got the certificate id 5. in bash created a project , inside the project ive used
suitecloud account:setup:ci --authid sb3 --certificateid akjsdfajrRANDOMjfbarkfj --privatekeypath /Users/shreesashti.lk/Documents/SDF/Authentication_Files/SB3/private.pem --account 123456_SB3
6. The bash says authenticating ... and throws the above errors
Note : i read somewhere i had to use the "SuiteCloud Development Integration" integration record rather using my own integration record to create the certificate. Still got the
There was an error with the private key used to authenticate. Verify the contents of the private key.
j
a few people have been unable to get EC keys working and will get that "error with the private key" error unless an RSA key is used, the third example on that page you linked. the error you got with the RSA key looks like it got further so i think that's the case with you here too. not sure why it's not liking your certificate though, i assume the
akjsdfajrRANDOMjfbarkfj
is in place of the actual certificate id copied form your account?
s
hi @Jonathan MacKenzie, thanks for the response . THe
akjsdfajrRANDOMjfbarkfj
was typed on purpose to mask the actual certificate id
m
i did have the same issue using the rsa command suggested in documentation, instead i used this to generate my keys:
openssl req -x509 -newkey rsa:4096 -sha256 -keyout private-key.pem -out certificate.pem -nodes -days 365
Anyway, we usually use the native Developer role (not custom) and as you said Suitecloud Development Integration and this commands in our CI
s
Thanks @Marcos Lopez for the input , let me try out these and get back.
Perfect . It worked 🫡. @Marcos Lopez thanks. your openssl worked .
🙌 1
a
I did the same as suggested in the above pic.but i got a new error while authenticating with CI, "server error. Verify the argumens of the command and that the account gad the following features enabled: OAuth 2.0 and Suite cloud Development Framework"
s
Is setting domain a mandatory parameter in setting up the account? If yes what is the value that to be passed?