Refresh token too long?

Hi, i have an issue using an API from legrand. The API (https://partners-login.eliotbylegrand.com/token) uses the following params in the body: client_id, client_secret, Grant_type and refresh_token. When I fire this API using postman, it works as a charm but I cannot manage to get it working in NodeRed.

I suspect the refresh token. When I debug the payload object is see the following:

object

grant_type: "refresh_token"

client_id: "removed for security reasons"

client_secret: "removed for security reasons"

refresh_token: "eyJraWQiOiJjcGltY29yZV8wOTI1MjAxNSIsInZlciI6IjEuMCIsInppcCI6IkRlZmxhdGUiLCJzZXIiOiIxLjAifQ..oJPLiUqnNpTvySru.bVMHIXdcpPKSppZlX_swjkYlohSk5zkgg5b_7pXQaYwDhmY_Z5o1EYN2fnBtv5wG0U-QWUOITA8kBDoZJQlJuHe6gTFdyGY5knPsO_rD3iiGRflilvpIcgQtLHVLguOAjbAOyYZVxCLfXeWcuYOy0EcrR_VYbpeogNyOi8E7aA3F_hvfZhsojzBek9Kk-2VcP8aB2g7FQe8qeCr2Tzl3v3mpQQnMXX_ls3VikLBTGQk-77htGgTze7RHwJwSp_1O7yFMk4c5wNmscpBaskxl18buq1dCLUENAGY66074EmvuHSOIaZtOeCsOoIeUwqRaew8WujZ1io70rbEElp3-XgPouAK0IqIjau6F0wGSgnuRvHE1Vjys7iFJQ8qLZsBYMzuKpN_zEJIkT1-yzt7KFKfI-yjj9yzdDi_PKBZSoSnpMgbZ_4EWlhqCdO1tVtt_PGMuzYwisYZCbnI65Z1Iz9FEeWMIb8yA8hxzqd8DgKC77OJZp_X8aaNznPfsJgrm3oA1F-KA0wc5MQrR_szqYNNArfgN45MQe26inT1eqW5TxxokDSTEWaGPJud4dy6J89C7eBkxuadHrYLCQ45upAhltsGBESR99ZSFsqfHBhjLJpnqCo1E2ygItA_m7Gux0gvBbpBtLdhPL8IwtGiD3ptGGC3qCqpPVniRzXdKHsNeJKetKu_kElRg-eOlYtQsalMl8VPmMMm4gwOF75x-SFHUNHb_vdRu76QZXY-R6iZkvPj8zNkKvlDBzqtbdKqmPVpk4VJaljoBKNcIx7eMmGNfnxpALEX-rzUJYVh2DNrEf-FWWJ5dS5inkv2V__SdUM9JdFyaaI949bBHdA0cFXvl_VHR8JdhM_lUOPrLLAMK5VH7qXJKiu3UKNb..."

As you can see it end with ..., probably because it is too long ?

the original refresh token looks like: eyJraWQiOiJjcGltY29yZV8wOTI1MjAxNSIsInZlciI6IjEuMCIsInppcCI6IkRlZmxhdGUiLCJzZXIiOiIxLjAifQ..oJPLiUqnNpTvySru.bVMHIXdcpPKSppZlX_swjkYlohSk5zkgg5b_7pXQaYwDhmY_Z5o1EYN2fnBtv5wG0U-QWUOITA8kBDoZJQlJuHe6gTFdyGY5knPsO_rD3iiGRflilvpIcgQtLHVLguOAjbAOyYZVxCLfXeWcuYOy0EcrR_VYbpeogNyOi8E7aA3F_hvfZhsojzBek9Kk-2VcP8aB2g7FQe8qeCr2Tzl3v3mpQQnMXX_ls3VikLBTGQk-77htGgTze7RHwJwSp_1O7yFMk4c5wNmscpBaskxl18buq1dCLUENAGY66074EmvuHSOIaZtOeCsOoIeUwqRaew8WujZ1io70rbEElp3-XgPouAK0IqIjau6F0wGSgnuRvHE1Vjys7iFJQ8qLZsBYMzuKpN_zEJIkT1-yzt7KFKfI-yjj9yzdDi_PKBZSoSnpMgbZ_4EWlhqCdO1tVtt_PGMuzYwisYZCbnI65Z1Iz9FEeWMIb8yA8hxzqd8DgKC77OJZp_X8aaNznPfsJgrm3oA1F-KA0wc5MQrR_szqYNNArfgN45MQe26inT1eqW5TxxokDSTEWaGPJud4dy6J89C7eBkxuadHrYLCQ45upAhltsGBESR99ZSFsqfHBhjLJpnqCo1E2ygItA_m7Gux0gvBbpBtLdhPL8IwtGiD3ptGGC3qCqpPVniRzXdKHsNeJKetKu_kElRg-eOlYtQsalMl8VPmMMm4gwOF75x-SFHUNHb_vdRu76QZXY-R6iZkvPj8zNkKvlDBzqtbdKqmPVpk4VJaljoBKNcIx7eMmGNfnxpALEX-rzUJYVh2DNrEf-FWWJ5dS5inkv2V__SdUM9JdFyaaI949bBHdA0cFXvl_VHR8JdhM_lUOPrLLAMK5VH7qXJKiu3UKNbhpuW8.E0QwEBDh5RR91QfzLxN5jw

any idea's?

Hi Peter67,
Welcome to the NR forum.

The debug output is set by default to 1000 characters.
To see more in your debug window you have to change debugMaxLength: 1000, in your settings.js file.

1 Like

Hi, thanks. I changed the debugMaxLength and now the refresh token is shown correctly in the debug window. But still facing the error requesting the refresh token. Can't find the reason why it's not working, as mentioned, it works using postman. I exported my test flow below. Any idea's?

[{"id":"d6644353.62e9b","type":"change","z":"838a9b3f.571d18","name":"Prepare request","rules":[{"t":"set","p":"payload","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"payload.grant_type","pt":"msg","to":"refresh_token","tot":"str"},{"t":"set","p":"payload.refresh_token","pt":"msg","to":"eyJraWQiOiJjcGltY29yZV8wOTI1MjAxNSIsInZlciI6IjEuMCIsInppcCI6IkRlZmxhdGUiLCJzZXIiOiIxLjAifQ..oJPLiUqnNpTvySru.bVMHIXdcpPKSppZlX_swjkYlohSk5zkgg5b_7pXQaYwDhmY_Z5o1EYN2fnBtv5wG0U-QWUOITA8kBDoZJQlJuHe6gTFdyGY5knPsO_rD3iiGRflilvpIcgQtLHVLguOAjbAOyYZVxCLfXeWcuYOy0EcrR_VYbpeogNyOi8E7aA3F_hvfZhsojzBek9Kk-2VcP8aB2g7FQe8qeCr2Tzl3v3mpQQnMXX_ls3VikLBTGQk-77htGgTze7RHwJwSp_1O7yFMk4c5wNmscpBaskxl18buq1dCLUENAGY66074EmvuHSOIaZtOeCsOoIeUwqRaew8WujZ1io70rbEElp3-XgPouAK0IqIjau6F0wGSgnuRvHE1Vjys7iFJQ8qLZsBYMzuKpN_zEJIkT1-yzt7KFKfI-yjj9yzdDi_PKBZSoSnpMgbZ_4EWlhqCdO1tVtt_PGMuzYwisYZCbnI65Z1Iz9FEeWMIb8yA8hxzqd8DgKC77OJZp_X8aaNznPfsJgrm3oA1F-KA0wc5MQrR_szqYNNArfgN45MQe26inT1eqW5TxxokDSTEWaGPJud4dy6J89C7eBkxuadHrYLCQ45upAhltsGBESR99ZSFsqfHBhjLJpnqCo1E2ygItA_m7Gux0gvBbpBtLdhPL8IwtGiD3ptGGC3qCqpPVniRzXdKHsNeJKetKu_kElRg-eOlYtQsalMl8VPmMMm4gwOF75x-SFHUNHb_vdRu76QZXY-R6iZkvPj8zNkKvlDBzqtbdKqmPVpk4VJaljoBKNcIx7eMmGNfnxpALEX-rzUJYVh2DNrEf-FWWJ5dS5inkv2V__SdUM9JdFyaaI949bBHdA0cFXvl_VHR8JdhM_lUOPrLLAMK5VH7qXJKiu3UKNbhpuW8.E0QwEBDh5RR91QfzLxN5jw","tot":"str"},{"t":"set","p":"payload.client_id","pt":"msg","to":"removed for security","tot":"str"},{"t":"set","p":"payload.client_secret","pt":"msg","to":"removed for security","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":240,"y":100,"wires":[["bdc07e1f.e38c5","94d84c05.cb7b4"]]}]

found the issue, have to add the following msg header

msg.headers["content-type"] should be set to application/x-www-form-urlencoded .

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.