Invalid client error on node js parse

Good afternoon, I ran into an invalid client problem when trying to parse a document, all the paths are correct, I think the error lies in my access keys
BOOK_READER_CLIENT_ID is the Client Id that is listed in my application and BOOK_READER_CLIENT_SECRET is the Client Secret that is listed there
Here is the piece of code I am trying to run

async readBook(req, res, next) {
        try {
            const book = await BookModel.findById(req.params.id);

            if (!book) {
                return res.status(404).json({message: 'Книга не найдена'});
            }

            const config = new Configuration(
                process.env.BOOK_READER_CLIENT_ID,
                process.env.BOOK_READER_CLIENT_SECRET
            );
            const parseApi = new ParseApi(config);
            const fb2FilePath = path.join(__dirname, `../uploads/books/${book.fileName}`);

            const fileBytes = fs.readFileSync(fb2FilePath);

            const parseOptions = new ParseOptions();
            parseOptions.filePath = 'document.fb2';

            const response = await parseApi.parse(new ParseRequest(parseOptions, fileBytes));

            const parsedText = response.text;

            res.send(`
        <html>
          <head>
            <title>FB2 Parsing</title>
          </head>
          <body>
            <pre>${parsedText}</pre>
          </body>
        </html>
      `);
        } catch (e) {
            next(e)
        }
    }

And here is my answer when a try to send book id

{ message: 'invalid_client', code: 400 }

@Daskis

Please share your credentials(Client Id and Client Secret) for investigation via a private message .

here

@Daskis

Thanks for sharing the credentials. I am afraid I could not get your code to work. Can you please point me to the source from which you got this code?

I asked GhatGPT for it, but I don’t think that it is a problem, I also looked in other sources, in fact the principle of operation is the same. If not difficult, can you write an example of a working code? For node js, which already gives the finished text from the file

@Daskis

Thanks for your feedback. Actually, your sample code is not correct, as we do not have any method that processes files from the request body.

You need to upload your input file to cloud storage and later extract text. Please check out the following test case for reference. Hopefully, it will help you accomplish the task.

I didn’t really understand the code you sent me.
I imagined that I take a file that is located locally on the server, send it to the API and get the result.
This may be a little arrogant, but could you please correct my code?

async readBook(req, res, next) {
         try {
             const book = await BookModel.findById(req.params.id);

             if (!book) {
                 return res.status(404).json({ message: 'Book not found' });
             }

             const config = new Configuration(
                 process.env.BOOK_READER_CLIENT_ID,
                 process.env.BOOK_READER_CLIENT_SECRET
             );

             const parseApi = new ParseApi(config);

             const fb2FilePath = path.join(__dirname, `../uploads/books/${book.fileName}`);

             const uploadRequest = new UploadFileRequest("path/on/cloud/document.fb2", fs.readFileSync(fb2FilePath));
             await parseApi.uploadFile(uploadRequest);

             const parseOptions = new ParseOptions();
             parseOptions.filePath = "path/on/cloud/document.fb2";

             const parseRequest = new ParseRequest(parseOptions);
             const response = await parseApi.parse(parseRequest);
             const parsedText = response.text;

             res.send(`
                 <html>
                     <head>
                         <title>FB2 Parsing</title>
                     </head>
                     <body>
                         <pre>${parsedText}</pre>
                     </body>
                 </html>
             `);
         } catch (error) {
             next(error);
         }
     }}

@Daskis

We are sorry for the inconvenience. I noticed the GroupDocs.Parser Cloud SDK for Node.js is not working as expected. We have logged a ticket(PARSERCLOUD-340) for further investigation and rectification. We will notify you as soon as the issue is resolved.

Is there any update related to this?

@ishanem

Please install the latest version of the GroupDocs.Parser Cloud SDK of Node.js. It seems the issue is resolved in it.