I am sending NLAuth requests with email and passwo...
# general
t
I am sending NLAuth requests with email and password for a customer account to the rest token issue endpoint to generate OAuth tokens. In sandbox, this works and I get tokens as expected. In production I get the following error instead: { "error": { "code": "USER_ERROR", "message": "A valid session is required. Please log in first." } } I imported the TBA-based role from Sandbox so it is not modified. I am also able to log directly into the account using the UI. Any ideas?
b
you can try issuing the token via the ui
if you really want to try troubleshooting here, you need to give things like the urls and parameters you are using, which is hit or miss since you probably want to strip out all the useful information
n
@Terry M Have you verified the url and also the production account id? I would suggest using Postman and try sending a sample request to see the exact error.
t
Headers are:
Authorization: NLAuth nlauth_account=12345678,nlauth_email=user@example.com,nlauth_signature=password
I have tried also with appending ,nlauth_role=1234,nlauth_application_id=ABCD-1234-EFGH-5678-IJKL
I realize the useful information is stripped - but if I modify the headers like so:
Authorization: NLAuth nlauth_account=12345678_SB1,nlauth_email=user@example.com,nlauth_signature=password
and switch the consumerKey to sandbox consumer key
it works just fine
and I have checked that the consumer key is correct for the integration in production and sandbox. I have reset both
and I have checked that users have a TBA role enabled
just found the answer - sandbox and production are on different subdomains. Am now using the roles rest service to add that part in. Thanks for helping everyone
Even better answer: instead of using the rest roles service, you can use an account-specific subdomain such as https://ACCOUNTID.restlets.api.netsuite.com/rest/issuetoken
This will save an unnecessary request