Error when connecting via Oauth2 to Yandex.Disk

When connecting via Oauth2 to Yandex.Disk, I get an error - UnauthorizedError.

I filled out everything as described.
Please help with authorization.
Thank you.

What is the error message (if any)? UnauthorizedError

Please share the workflow

(Select the nodes and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow respectively)

Share the output returned by the last node

<!-- {"status":"rejected","reason":{"message":"401 - {\"message\":\"Не авторизован.\",\"description\":\"Unauthorized\",\"error\":\"UnauthorizedError\"}","name":"Error","stack":"Error: Request failed with status code 401\n at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11)\n at IncomingMessage.emit (node:events:525:35)\n at IncomingMessage.emit (node:domain:489:12)\n at endReadableNT (node:internal/streams/readable:1358:12)\n at processTicksAndRejections (node:internal/process/task_queues:83:21)"}} -->

Information on your n8n setup

  • **n8n version:**0.194.0
  • Database you’re using (default: SQLite):
  • **Running n8n with the execution process [own(default), main]:**main
  • **Running n8n via [Docker, npm,, desktop app]:**Docker

Hey @asuhan,

It looks like Yandex is not happy with the credentials being used, Looking at your OAuth credential screenshot you don’t have any scopes set. Does Yandex not require any?

Good afternoon, Jon. Scopes are required, but they are already provided to the application.
If I connect using a debug token, i.e. manually insert it into the request, the request passes.
There must be some problem with getting the token itself in Credential.

Hey @asuhan,

I suspect the debug token is already authenticated using the scopes required which is why that works. Can you add the scopes to the credential and see if that helps, Normally just adding scopes to the application isn’t enough and the application authenticating also needs to confirm what scopes will be needed for the user authenticating but it could be that Yandex doesn’t work that way.

Does Yandex need anything anything else special when authenticating like an additional header to be sent? I am not aware of any issues with the OAuth implementation at the moment so I suspect it is going to be something Yandex specific.

With scopes in credentials, it does not skip at all…

Hey @asuhan,

We tend to split the scopes with spaces so that could be an issue, What does the error message say there?

I separated scopes with spaces, the error is the same.
“status”: “rejected”,
{ “reason”: {
“message”: “401 - {“message”: “Not Authorized.”, “description”: “Unauthorized”, “error”: “UnauthorizedError”}”
{ “name”: “Error”,

Hey @asuhan,

Have you tried the other authentication method? Do you have a link to the OAuth documentation for Yandex?

Good day, Jon. Accessing the API - API. Yandex.Disk API

Hey @asuhan,

That is interesting, They mention on that page that they expect Authorization: OAuth xxxyyyzzz but we send Authorization: Bearer xxxyyyzzz I wonder if they only support that header value or if they support bearer as well :thinking:

Maybe that’s why it works with the debug token, because there I manually wrote “OAuth y0_AgAAAAADDkqcAAhv9wAAAADPu…”

I can’t see anything to suggest they don’t support it but I would be surprised…

This is all a bit odd, I may have to make an account and see what is going on.

I would be very grateful to you, Jon. I hope you have time for this.