QR code scanning problem with the api scan
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Describe the bug
When I am scanning the generated qr code provided by whatsapp.web.js i am not able to login to the server. It shows following error:
Invalid QR code Make sure you’re scanning a QR code displayed on WhatsApp app. If it continues to not work, update the app or refresh the page and try again
Expected behavior
As a user, I expected to login when I scan the qr code with code scanner in whatsapp mobile applicaiton
Steps to Reproduce the Bug or Issue
- Initiate the whatsapp client like this:
const { Client, MessageMedia, LocalAuth } = require("whatsapp-web.js");
const whatsapp_client = new Client({
qrTimeoutMs: 0,
puppeteer: {
headless: false,
args: [
"--no-sandbox",
"--disable-setuid-sandbox",
"--unhandled-rejections=strict",
"--disable-dev-shm-usage",
"--fast-start",
]
},
// session: sessionCfg,
authStrategy: new LocalAuth({
clientId: "uniqid"
})
});
- Send the qr code to frontend Here i am using socket.io to communicate with frontend
whatsapp_client.on("qr", qr => {
socket.emit("qr", qr);
});
- Generate QR code with any frontend library.
Here i am using
qrcode.js
in javascript I also tried usingphpqrcode/qrlib.php
to generate barcode but still getting same problem 😦 - Scan the QR code in whatsapp mobile application
Relevant Code
No response
Browser Type
Chromium
WhatsApp Account Type
Standard
Does your WhatsApp account have multidevice enabled?
Yes, I am using Multi Device
Environment
OS: Ubuntu 20 Phone OS: Android 8.1.0 whatsapp-web.js version: 1.16.6 WhatsApp Web version: 2.2218.8 Node.js Version v16.4.2
Additional context
No response
Issue Analytics
- State:
- Created a year ago
- Comments:10
Top Results From Across the Web
9 reasons Why Your QR Code is Not Working - Beaconstac blog
If the QR Code is still not working, try scanning it via an external QR Code scanner or update your operating system to...
Read more >Common QR Code Scanning Problems and How to Fix Them
Is your QR Code not working? Here is an overview on common QR Code scanning problems and how to solve them in this...
Read more >Build a Web QR Code Scanner using the Barcode Detection API
The article talks about how to build a web QR code scanner using ... The API aims at detecting features like faces and...
Read more >6 reasons why your QR code is not working - QRCode Monkey
Avoid breaking your QR code by being aware of a few things. Here are 6 things that can cause trouble when scanning your...
Read more >Trying to scan a QR Code then call an API - Stack Overflow
I am trying to create a mobile app where the user will scan a unique QR code, the program should then ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So the issue was when generating qrcode using php-qrlib or js qrcode (frontend), whatsapp is not recognising the code. Thanks @Yuri-Lima for sharing the solution
same here, only happens when deployed to vercel.