Anyone experienced with authenticating with the RE...
# general
b
Anyone experienced with authenticating with the REST API using M2M Client Credentials? I get 500 Server Error as my response code. I can't find much help on this
b
b
My error code only says 500 Server Error, there is no hint about what the problem might be
b
read how to use the login audit trail, then come back with the details
😂 1
b
But isn't this troubleshooting guide for the UI based flow with the auth token? I'm trying to use Machine to Machine (Client Credentials Flow)
b
at your stage, there isnt a difference
b
I see, i found the usage log on the Netsuite UI. I dont see any attempts listed from my integration record, only users
Maybe I have an issue with my integration record or M2M setup and so the post request isn't even associated with an application?
b
you want to be looking at timing
b
I have it sorted by most recent, i can see my user login from today
b
its something that you cant mess up
if you arent getting anything, then you are likely using the wrong url
b
"https://#####.suitetalk.api.netsuite.com/services/rest/auth/oauth2/v1/token" this is my url, of course with my correct account ID
Thank you for helping btw, i appreciate you!
b
that login audit trail will have a row if you just visit the url in a browser
b
You're right, id did show up when searching it in the browser
b
so now onto whatever you are using for your integration, are you sure you are using the correct url
the only thing the browser did correctly was the url
everything else was wrong
b
response = requests.post(_token_endpoint_, headers=headers, data=data) if i print token_endpoint just before my post request, it prints correctly
b
dont be fancy
you arent there yet
do the thing you know works
do a get
with only the url
you should hardcode it instead of using variables
b
ok let me try
hahaha
ok that works, using the get to the url hardcoded in, i see it show up in my login trail with invalidGrantType
b
graduate to a post
then your data, and then headers
i heavily advise hardcoding them before moving onto variables
b
why?
b
you are skipping the first steps and are adding in multiple things at the same time
do one thing at a time, so that you can figure out where you are making the mistake
there is no point to a variable if its the same value every time, it just adding complexity
b
so when i add in my data i get the 500, that with using no headers in the request.
b
same answer answer
start smaller
start with an empty request body
then one key
b
So im getting 400 invalidRequest until I add the JWT in, then it changes to 500. Would you say that points to the JWT as the issue? since it makes sense that i'd get invalidRequest when sending only a partial body?
b
sounds like it, its badly formed enough to be making the server 500 with no details
that said, anything wrong in the jwt is no different than everything wrong
one of the requirements for encryption
b
its gonna be hard to track down the issue then
b
what does the code to generate the data look like
b
I kept the variables in for privacy, but i know you recommended hard coding them
b
not enough code shared, specifically i dont know which libraries you are using
b
Here is the full script just to grab the token
hey i got through in the end. thanks
b
Bobby, I am running into a similar issue and my code looks pretty identical to what you had in the morning. Can you share what you changed to get an access token back?
Posting my code as well to re-open this thread. I get 4XX error messages for the 'baby-steps' requests recommended above, but 500-Server Error when I submit what I think should be a full request. The 4XX baby steps requests appear in the login audit log, but the full POST request with 500 response does not appear in the log. Anyone else run into this issue? Could it really be a NetSuite server issue? The docs refer to a 'client ID' for the integration but the field I see on the integration record is called 'application ID', is using the 'application ID' as the 'iss' possibly the issue?
Using Application ID was the issue. There is a Client ID shown only once upon creation of the integration record, when using that I get a proper access token.
245 Views