salesforce-marketingcloud / FuelSDK-Node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error with legacy /v1/requestToken endpoint

kabzit13 opened this issue · comments

I have beam provided with new set of ClientId ClientSecret and when using them, I am getting error:
Error: No access token�[0m
Stack:
error properties: Object({ res: Object({ message: 'This integration is not eligible to use the legacy /v1/requestToken endpoint because the integration uses enhanced OAuth 2.0 functionality. To obtain a token for this integration, use the applicable Marketing Cloud OAuth 2.0 endpoint for authentication. For a web or public app, use /v2/authorize and then /v2/token. For a server-to-server integration, use /v2/token.', errorcode: 10007, documentation: '' }) })
Error: No access token
at FuelSoap. (/Users/ivanchol/Documents/projects/dmc-builder-data-extensions/node_modules/fuel-soap/lib/fuel-soap.js:99:21)
at _requestToken.then.body (/Users/ivanchol/Documents/projects/dmc-builder-data-extensions/node_modules/fuel-auth/lib/fuel-auth.js:91:19)
at process._tickCallback (internal/process/next_tick.js:68:7)

But same code with old credentials working as expected.
Thanks.

Latest release should support the auth flow forced on new credentials. I believe you need to set in the options that you are using the new auth flow

Hi @kabzit13! The error you're getting means you are using the credentials of a package with enhanced functionality, which requires OAuth2 authentication. To use this feature, you should instantiate the client like in the example below:

const client = new ET_Client(clientId, clientSecret, stack, {origin, authOrigin, soapOrigin, authOptions = { authVersion = 2, accountId = <<TARGET_BUSINESS_UNIT>>, scope = <<DATA_ACCESS_PERMISSIONS>>}}); 

authOptions is required for OAuth2 authentication.