Problem with comma separated scopes with OAuth2

Describe the problem/error/question

I wanted to create an OAuth2 credential for Pinterest API using the generic OAuth2 API credential.

When specifying multiple scopes (separated by comma as per the documentation), the API respond with an error:

None of the given scopes are valid: "['ads:read catalogs:read user_accounts:read']"

When checking the authorization url generated by n8n, we can see that the scopes are separated by an encoded character, which turns out to be spaces (" "):

scope=ads%3Aread%20catalogs%3Aread%20user_accounts%3Aread

Decoded version:

ads:read catalogs:read user_accounts:read.

Here’s what I’ve filled in the credential form:

ads:read,catalogs:read,user_accounts:read

So my question is: How can I prevent n8n to replace my comma by spaces ?
I tried to:

  • Use encoded comma as separator
  • Escape them
  • Quote them

But none of the above did work.

Also, passing the scopes as Auth URI Query Parameters didn’t do the trick for me.

Maybe adding an option to specify the scopes separator could fix the issue ?

Thanks in advance.

Information on your n8n setup

  • n8n version: 0.224.2
  • Database: PostgreSQL
  • Running n8n: self-hosted via Docker

Hi @aminebeh, welcome to the community!

I am sorry you are having trouble.

n8n would split the scopes string on the comma into an array (which is then passed on to the respective OAuth2 library, putting them together separated by spaces as per the OAuth2 RFC).

n8n does not currently have support for non-standard OAuth2 implementations such as the Pinterest one you have shared. As such I’ve converted your request into a feature request, allowing you and other users to vote on having such a functionality implemented.

1 Like

Hi @MutedJam !

Thanks for your reply :smiley: and I’ll find a workaround until then :wink:

1 Like

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