Describe the issue/error/question
Hi, i’m looking to connect to mogenius API ( Refresh-Tokens (mogenius.com)) using the http node to manage my container hosted on their platform.
- To use the API, i will need to send a login request to generate an accessToken.
- The accesstoken is required for all other API functions.
- The accesstoken will expire after like 3 days.
- The accesstoken is issued per device.
- They will issue an accessToken along with a refreshToken. refreshToken is used to generate new accessToken (with new validity) for the same device.
I can simply use the Login API request using http node to generate a new accesstoken and continue doing other stuffs using that token on single execution. If i’m using this method, each execution will register new device with their own accesstoken, and I will ended up with a super long list of devices/tokens in my account dashboard. They suggested to utilise the refreshToken API to generate a new accessToken for the same device. So there will be only 1 device linked to the account with dynamic accessToken every time I called the refresh token request before doing other tasks.
Need help on…
- The accessToken cannot be saved as permanent credential as it has short validity.
- I’m looking for a way to use the refresh token API to generate a new accessToken to be passed on the next node, at the same time save the new refreshToken somewhere in n8n to be called/used for the next execution cycle. Each cycle will replace & save the new refreshToken string.
Please share the workflow
I’m executing this Login API manually only 1 time time to register the n8n connection and generate the initial refreshToken. Tried to save it as binary as the source of refreshToken for future execution.
Information on your n8n setup
- n8n version: 0.217.2
- Database you’re using (default: SQLite): postgresql
- Running n8n with the execution process [own(default), main]: default
- Running n8n via [Docker, npm, n8n.cloud, desktop app]: docker