Manual setting of "state" variable (oauth2)


Currently I’m trying to add an api using oauth2, however this service requires me to use a user specific identification string inside the “state” variable. How could I do this? I have already tried to manually specify a state variable in the server.js file which got me a bit further but now the OAuth2 callback state is invalid. (Server.js:830).

Thanks in advance.


Welcome to the community.

@jb2210 Try adding it to the Auth URI Query Parameters. Check the image below:

thanks for the fast reply!

I also already tried this, however n8n seems to first take its own value and then overwrite the whole thing with &state={provided state}

which result in the following error:
“Invalid state format returned”

I am able to obtain the access code manually, is there any way I could enter it manually?

I see. Then the state field will have to be added to the credentials. Will add it to my TODO list.

If you have the access token, you can add it directly to the HTTP Request Node in the authorization header, but this will work until the token expires.

1 Like

Awesome, Thanks for your time!

I will work around it using that method, thanks!