WhiskeySockets / Baileys

Lightweight full-featured typescript/javascript WhatsApp Web API
https://baileys.whiskeysockets.io/
MIT License
3.05k stars 1.04k forks source link

Mobile API outdated (MOBILE_TOKEN) #508

Open lauriolasw opened 7 months ago

lauriolasw commented 7 months ago

Hello! I tried using:

MOBILE_TOKEN = Buffer.from('0a1mLfGUIBVrMKF1RdvLI5lkRBvof6vn0fD2QRSM3d3683e76445591c0591bc3c034c3bca') MOBILE_USERAGENT = 'WhatsApp/2.23.13.82 iOS/15.3.1 Device/Apple-iPhone_7'

And had this error: { reason: 'old_version', status: 'fail', login: 'nnn' }

So, I attempted to update the token using the latest APK directly from the WA download site, and then md5sum:

MOBILE_TOKEN = Buffer.from('0a1mLfGUIBVrMKF1RdvLI5lkRBvof6vn0fD2QRSM9bf0dbb9983ac28770ab7c91af6b13f2') MOBILE_USERAGENT = 'WhatsApp/2.23.23.79 iOS/15.3.1 Device/Apple-iPhone_7'

And now have this error: { reason: 'bad_token', status: 'fail', login: 'nnn' }

I would appreciate any guidance or suggestions on how to resolve this issue

lauriolasw commented 7 months ago

My fault! correct token for 2.23.23.79 is '37dfd00588d059cec1b40fda769f2ddf', so:

MOBILE_TOKEN = Buffer.from('0a1mLfGUIBVrMKF1RdvLI5lkRBvof6vn0fD2QRSM37dfd00588d059cec1b40fda769f2ddf') MOBILE_AGENT = "WhatsApp/2.23.23.79 iOS/15.3.1 Device/Apple-iPhone_7"

Error is: { reason: 'no_routes', status: 'fail', retry_after: 3600, sms_wait: 0, voice_wait: 0, login: 'nnn92', flash_type: 0, wa_old_wait: 0, email_otp_wait: 0 }

potkek commented 7 months ago

Feel free to make a pull request for the changes

Davidaprilio commented 6 months ago

Can you tell me, what tool do you use to open WhatsApp network traffic? I also want to contribute about the issue at Baileys

zllyxr commented 6 months ago

My fault! correct token for 2.23.23.79 is '37dfd00588d059cec1b40fda769f2ddf', so:

MOBILE_TOKEN = Buffer.from('0a1mLfGUIBVrMKF1RdvLI5lkRBvof6vn0fD2QRSM37dfd00588d059cec1b40fda769f2ddf') MOBILE_AGENT = "WhatsApp/2.23.23.79 iOS/15.3.1 Device/Apple-iPhone_7"

Error is: { reason: 'no_routes', status: 'fail', retry_after: 3600, sms_wait: 0, voice_wait: 0, login: 'nnn92', flash_type: 0, wa_old_wait: 0, email_otp_wait: 0 }

My fault! correct token for 2.23.23.79 is '37dfd00588d059cec1b40fda769f2ddf', so:

MOBILE_TOKEN = Buffer.from('0a1mLfGUIBVrMKF1RdvLI5lkRBvof6vn0fD2QRSM37dfd00588d059cec1b40fda769f2ddf') MOBILE_AGENT = "WhatsApp/2.23.23.79 iOS/15.3.1 Device/Apple-iPhone_7"

Error is: { reason: 'no_routes', status: 'fail', retry_after: 3600, sms_wait: 0, voice_wait: 0, login: 'nnn92', flash_type: 0, wa_old_wait: 0, email_otp_wait: 0 }

Why is my result 9bf0dbb9983ac28770ab7c91af6b13f2,can you tell me why. please

lauriolasw commented 6 months ago

correct token for 2.23.23.79 is '37dfd00588d059cec1b40fda769f2ddf'

To calculate: versionMD5Hex = crypto.createHash('md5').update('2.23.23.79').digest('hex');

Riders004 commented 5 months ago

My fault! correct token for 2.23.23.79 is '37dfd00588d059cec1b40fda769f2ddf', so:

MOBILE_TOKEN = Buffer.from('0a1mLfGUIBVrMKF1RdvLI5lkRBvof6vn0fD2QRSM37dfd00588d059cec1b40fda769f2ddf') MOBILE_AGENT = "WhatsApp/2.23.23.79 iOS/15.3.1 Device/Apple-iPhone_7"

Error is: { reason: 'no_routes', status: 'fail', retry_after: 3600, sms_wait: 0, voice_wait: 0, login: 'nnn92', flash_type: 0, wa_old_wait: 0, email_otp_wait: 0 }

How to find that token

lairhas commented 1 month ago

Is there any update on this?

Riders004 commented 1 month ago

Maybe got fixed in 6.7.0 of baileys

lauriolasw commented 1 month ago

Yes! 6.7.0 fixed

-or- If you cannot upgrade to version 6.7.0, update the files:

src/Utils/validate-connection.ts const version = config.mobile ? [2, 24, 6] : config.version

src/Defaults/index.ts MOBILE_TOKEN 0a1mLfGUIBVrMKF1RdvLI5lkRBvof6vn0fD2QRSMc39deee27ac1a897bf07840afa7d734a MOBILE_AGENT WhatsApp/2.24.6.77 iOS/15.3.1 Device/Apple-iPhone_7

It worked for me!

lairhas commented 1 month ago

Yes! 6.7.0 fixed

-or- If you cannot upgrade to version 6.7.0, update the files:

src/Utils/validate-connection.ts const version = config.mobile ? [2, 24, 6] : config.version

src/Defaults/index.ts MOBILE_TOKEN 0a1mLfGUIBVrMKF1RdvLI5lkRBvof6vn0fD2QRSMc39deee27ac1a897bf07840afa7d734a MOBILE_AGENT WhatsApp/2.24.6.77 iOS/15.3.1 Device/Apple-iPhone_7

It worked for me!

Thanks @lauriolasw, it works once, but when I tried for the 2nd time, it get me no_routes, again. Is there any possibility WhatsApp block my IP or my WhatsApp number?


Update It works now, but I'm still confused with the logic behind it. When I execute enterCode, I get this response: { "status": "ok", "type": "existing", "lid": "344939565xxxx", "login": "628777832xxxx", "security_code_set": false, "autoconf_type": 1, "secure_verifier": false } Which mean the registration is successful. But when it execute registration = sock.authState.creds || { registration: {} }, it keep getting registration: {} which mean the creds is empty.

Nux-xader commented 2 weeks ago

0a1mLfGUIBVrMKF1RdvLI5lkRBvof6vn0fD2QRSM9bf0dbb9983ac28770ab7c91af6b13f2

where do you get the value of "0a1mLfGUIBVrMKF1RdvLI5lkRBvof6vn0fD2QRSM9bf0dbb9983ac28770ab7c91af6b13f2"?