Skip to content

[BUG] QR code doesnt appear on MacOS Desktop #2757

Description

@ayusc

Describe the bug
QR code doesnt appear with browser: Browsers.macOS("Desktop"),

To Reproduce
Steps to reproduce the behavior:
Try to generate QR code for login

Didn't got any QR code for login

Expected behavior
I should get da fuckin QR code to login man :<

Environment (please complete the following information):

  • Is this on a server? No
  • What do your connectOptions look like?
    makeWASocket({
        browser: browser: Browsers.macOS("Desktop"),
        logger: pino({ level: 'debug' }),
        auth: state,
        version,
    })
  • Do you have multiple clients on the same IP? no
  • Are you using a proxy? no

Additional context
I used the below script just for testing purpose

import qrcode from 'qrcode-terminal'
import makeWASocket, { Browsers, useMultiFileAuthState, fetchLatestBaileysVersion, DisconnectReason } from 'baileys'
import pino from 'pino'

async function initBaileys() {
    const { state, saveCreds } = await useMultiFileAuthState('auth_info')
    
    const { version } = await fetchLatestBaileysVersion()

    const sock = makeWASocket({
        browser: Browsers.macOS("Desktop"),
        logger: pino({ level: 'debug' }),
        auth: state,
        version,
    })

    sock.ev.on('connection.update', async (update) => {
        const { connection, lastDisconnect, qr } = update

        if (qr) {
            console.log('\nScan the QR code below using WhatsApp on your phone:\n')
            qrcode.generate(qr, { small: true })
        }

        if (connection === 'close') {
            const error = lastDisconnect?.error
            const statusCode = error?.output?.statusCode
            const shouldReconnect = statusCode !== DisconnectReason.loggedOut
            
            console.log('Connection closed due to:', error?.message, 'Reconnecting:', shouldReconnect)
            
            if (shouldReconnect) {
                initBaileys()
            }
        } else if (connection === 'open') {
            console.log('Connected to WhatsApp successfully!')
        }
    })

    sock.ev.on('creds.update', saveCreds)
}

initBaileys()

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions