I am trying to integrate n8n with the Tray platform (commercesuite) using OAuth 2.0, but I am having trouble obtaining and managing the access token automatically

Hello, everyone! Hope you’re doing well.

I’m developing an app on the Tray platform (commercesuite) and I’m looking for help integrating it with n8n, specifically with the OAuth 2.0 authentication flow.

Tray has provided me with the following credentials:

My goal is to automate the process in n8n, where I need to:

  1. Obtain the access token using this code;
  2. Store the tokens in a database (I’m using Supabase);
  3. Eventually, automatically renew the access token using the refresh token.

If anyone has experience with this integration, I would love some guidance on:

  • The best workflow structure for this setup;
  • Handling the redirection/callback for the authorization code;
  • Keeping the access token updated without needing the code again.

Any help or references would be greatly appreciated!

Thanks in advance!