We've created an app for HubExchange which is now listed. When a user opens the app, we receive the encoded JWT payload through the application login endpoint as documented here. We decode this payload (using the JWT secret key) to get the oauthToken (along with some other parameters) and we use this auth token for subsequent in-app REST and SOAP requests. So far, so good.

The token expires after one hour and I'm not sure how to refresh it. Sure, there's a refreshToken included in the decoded JWT payload, but you need a clientId and clientSecret to request a new token using the refreshToken (indicated in the node-fuel module).

We tried using the clientId and clientSecret associated with the app from App Center, but unsurprisingly that does not work, we get {"message": "Unauthorized", "errorcode": "1", "documentation": ""} response.

Does anyone know how we can use a refreshToken after an hour, for the use case where a user has the HubExchange app open for longer than one hour?

  • Relevant: Marketing Cloud oAuth and RefreshToken Expires after First Use. We've had similar issues. Our API guys say SFMC isn't doing oAuth correctly. – Adam Spriggs Feb 5 '16 at 12:24
  • The clientID and clientSecret that are used with the RefreshToken would be the ones generated when you created the App in App Center. If you use that clientId and clientSecret without a refreshToken, do you get the same "Unauthorized" response? – Mac Feb 26 '16 at 19:54

Try this: var fuel = require('fuel').configure({ authUrl: 'https://auth.exacttargetapis.com/v1/requestToken', clientId: 'xxxxxxxxxxxxxxxxxxxxxxxx', clientSecret: 'yyyyyyyyyyyyyyyyyyyyyyyy', refreshToken: 'zzzzzzzzzzzzzzzzzzzzzzzz', accessType: 'offline' });

refreshToken <- put refresh token from sso session

| improve this answer | |
  • This isn't what I'm looking for. As per my question above, your solution requires a clientId and clientSecret, but if you have created a public HubExchange app, you don't have these credentials (as they will vary by the end user). – Eliot Harper Mar 17 '16 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.