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).
I also already tried this, however n8n seems to first take its own value and then overwrite the whole thing with &state={provided state}
eg:
https://…h…s.org/rest/oauth2-credential/callback?code=5f***********9pP&state=&state=eyJraWQiOiJzZXNzaW…
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.
@RicardoE105 can I use the OAuth2 API credential for the “Client Credentials” flow, where the app gets a token, non interactively, from the server and uses it to access an API?
Thanks for the reply!
Do you see any alternative, from the available n8n credentials, that does that? Picks the “expires_in” variable from the response and automatically updates the token?