python-bna: bna restore: bna.http.HTTPError: mobile-service.blizzard.com returned status 502
Is this project still supported? Not sure how much you can do if the battlenet endpoints got changed, but maybe someone has an idea.
Traceback (most recent call last):
File "/home/maximilian/.local/bin/bna", line 8, in <module>
sys.exit(main())
File "/home/maximilian/.local/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/home/maximilian/.local/lib/python3.8/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/maximilian/.local/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/maximilian/.local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/maximilian/.local/lib/python3.8/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/maximilian/.local/lib/python3.8/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/maximilian/.local/lib/python3.8/site-packages/bna/cli.py", line 222, in restore
secret = bna.restore(serial, restore_code)
File "/home/maximilian/.local/lib/python3.8/site-packages/bna/http.py", line 129, in restore
challenge = client.initiate_paper_restore(serial)
File "/home/maximilian/.local/lib/python3.8/site-packages/bna/http.py", line 48, in initiate_paper_restore
response = self.post("/enrollment/initiatePaperRestore.htm", data=serial)
File "/home/maximilian/.local/lib/python3.8/site-packages/bna/http.py", line 32, in post
raise HTTPError(
bna.http.HTTPError: mobile-service.blizzard.com returned status 502
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 95 (2 by maintainers)
I just wanted to chip in and provide my 2 cents about this one. I followed above instructions and turns out you do not need to have the authenticator installed, do not have to use a special clientID. Just do the following to get 2fa secret:
baedda12fe054e4abdfc3ad7bdea970a
Make sure to tick the ‘auth.authenticator’ scope then click “Authorize,” paste the acquired client ID to the client ID input then click “Authorize.”client_id: ******
deviceSecret
and saveserial
andrestoreCode
as well for backup!!echo "PASTEYOURDEVICESECRETHERE" | xxd -r -p | base32
As you can see, lots of overlap, but streamlined process. Hope this helps the next person! Thanks @mx03 and @striczkof!
Here is another way without having to use the Battle.net App
1. Retrieve SSO Token:
EU-84902f44j57m687039586j7egdfa0a54-1165739690
2. Get Bearer Token:
Replace
<SSO_TOKEN>
with the token you got from step 1 and execute the following curl command to obtain the Bearer Token:Copy the Bearer Token to use in steps 3, 4. or 5.
3. Get Serial & Restore Codes:
Use the Bearer Token to fetch the Serial and Restore Codes of an existing authenticator:
4. Get Existing Authenticator Device Secret:
Use the Bearer Token, Serial, and Restore codes to retrieve the Device Secret of an Existing Authenticator:
5. Create and Add a New Authenticator:
Use the Bearer Token to create and add a new authenticator to the users account :
6. Add Authenticator to Password Manager.
After you have obtianed the
deviceSecret
convert it from hex to base32 usingecho "deviceSecret" | xxd -r -p | base32
on Linux/macOS or cryptii.com if on WindowsReplace
deviceSecret
in the following URL:otpauth://totp/Battle.net?secret=deviceSecret&digits=8
with the newly obtained base32 device secret, and you should have a working TOTP.LOL IT FUCKING WORKED HAHAHAHAHA THANK YOU SO MUCH @mx03
Sadly that forces everyone to download the app and login once before getting the client ID. Are you actually sure about the client ID being per-user? I’m gonna test with different accounts later if you haven’t tried that. And would non-rooted users be able to access that directory?
For those waiting for an app to automate these steps. (only slightly due to the way of getting the client ID/device secret) This is what I did:
/data/data/com.blizzard.messenger/shared_prefs/com.blizzard.messenger.authenticator_preferences.xml
/data/data/com.blizzard.messenger/shared_prefs/com.blizzard.messenger.authenticator_preferences.xml
com.blizzard.messenger.PREF_AUTHENTICATION_PROVIDER_CLIENT_ID
You can skip all the steps above with this client ID (as long as this doesn’t get changed lol):
baedda12fe054e4abdfc3ad7bdea970a
client_id: ******
deviceSecret
and might as well saveserial
andrestoreCode
for backupecho "PASTEYOURDEVICESECRETHERE" | xxd -r -p | base32
Here’s how i got it working with 1Password using Charles Proxy and the Battle.net App on my iPhone
Begin by downloading and installing Charles Proxy.
Navigate to Help > SSL Proxying within Charles Proxy and select Install Charles Root Certificate on a Mobile Device or Remote Browser. Follow the provided instructions to enable SSL Proxying for your iPhone.
Launch the Battle.net App on your iPhone. Then return to Charles Proxy and right-click on
https://authenticator-rest-api.bnet-identity.blizzard.net
within the list of sites and enable SSL Proxying.Inside the Battle.net App, enable the Authenticator. Then return to Charles Proxy, and expand the contents of
https://authenticator-rest-api.bnet-identity.blizzard.net
, then locate the device entry. Click on it, then go to Contents, and you will find an output similar to the following:Copy the deviceSecret and convert it from hex to base32 using
echo "deviceSecret" | xxd -r -p | base32
on Linux/macOS or cryptii.com if on WindowsReplace deviceSecret in the following URL:
otpauth://totp/BattleNet:Battle.net?secret=deviceSecret&digits=8
with the newly obtained base32 device secret, and you should have a working TOTP.Worrying news ahead
https://authenticator-rest-api.bnet-identity.blizzard.net/webjars/swagger-ui/index.html
Unable to access anymore----
It was fun while it lasted. Thanks Obama!
Go straight to step 5 after you get the bearer token if you don’t already have an authenticator
@ldehaas1612 @L-Goncalves Just found that when reading all the messages since last time I had to do this dance with Blizzard. Today I had just looked at the most recent set of instructions and didn’t realize there had to be a phone number on the account. Also, I definitely had a phone number on it before cuz the verification message when I just added my number showed the last time they sent verification to my number. Not sure why they removed my number at some point.
EDIT: It worked now, thanks.
Read carefully… You have to specify an phone number to your account in order to create a 2FA. This is their fallback method
I believe that the
requireHealup
value is if it needs a phone number, usually when I was attaching authenticators I would get that if no phone number was attached to the account.I thought so too, but it failed several times for me using the token from the 404 page. I’ve just rechecked, and the
BA-tassadar
value is different from the token value on the 404 page and the account page (same value both times). On Windows this time.So I’m not sure what is different for me? Maybe firefox, maybe the fact that I already have the Blizzard authenticator setup and I’m just trying to recover the devicesecret?
Regardless, I thought I would share as it may provide a resolution for others.
Using the SSO token from the 404 page URL should work without having to get it from the
BA-tassadar
value.Resolved my problem. In step 1, I grabbed the sso token at the 404 page. However, it changed between this page and the account overview. My success path was:
Login on a web browser, get to my account page and then extract the
BA-tassadar
value (thanks @L-Goncalves).Use @BillyCurtis step 2 for the bearer token and step 4 for the device secret (I already had the recovery code and serial info).
Thank you to all of the thread contributors - much appreciated.
Hello Everyone, I’ve been able to replicate the OAuth, you will need to first login into your account at account.battle.net
The open Dev Tools from the browser, go into Cookies Section and get the following value of the Cookie:
You will need to copy it and use in OAuth to get the bearer token to use in the Authenticator Rest API:
I’ve made Javascript script to do that but it can be converted to python too:
These 2 Functions are used to generate the SSO Token and the other one retrives the Bearer Token to use it then after having the bearer token you are free to use in the request for the rest api like that:
Wanted to add my two cents.
If you are unable to use command line for any reason to convert your secret, you can go to https://cryptii.com/pipes/hex-to-base32 get it made as well.
QRENCODE
If you can’t use qrencode command line, you can go to https://qrdex.io/ to make a QR for your authentication app. This link was created by a reddit user and does not appear to save your QR code or redirect it anywhere. However, use at your own risk.
@oelna
Just on that the
otpauth
url is supposed to look like this:The number after the the issuer “Battle.net” is supposed to be the serial, (it’s in that JSON structure that is returned) and that is how it was with the old
python-bna
tool. This won’t stop it from working however if you have something else in there.@ldehaas1612
Me neither. I suspect Blizzard wanted to retire the old API used by the old app for a more standard approach with swagger oauth2 as it’s quite clear they’re removing legacy services that didn’t support OAuth. I also suspect it’s easier for them to invalidate all old authenticators before a certain date than try to migrate them.
Also by having one official app there is now only one codebase to maintain and make sure meets the Google Play target API requirements.
It is both, similar to MS Authenticator. Push and manual generation (fallback) are available.
I am using the new bent authenticator after migrating a while back and recently extracted my secret using the REST API with the steps above. The POST can be used to retrieve your secret.
I have a feeling that re-registering the authenticator using the
authenticator
POST from the REST with the existing restore data might be enough to trigger the migration. But I cannot tell that for sure.Yeah I got that email too and I was using Battle.net Authenticator App at some point but then migrated to Bitwarden/Aegis.
The real question is if you associate a new authenticator against the new endpoints backing the new mobile app (or restore the existing authenticator into it), will they still strip it come Jan 6th? I can see this happening for 2 reasons:
I have simply restored my existing authenticator following the procedure above, but as far as I can see, there is no way to verify after doing this we still won’t get the authenticator stripped.
Yes. That is the method I used. Currently I am using this with 1Password.
This totally worked for me. Without ever installing the Authenticator app, I got the secret from the API, put it in the setup URL like so:
otpauth://totp/BattleNet:Battle.net?secret=<yoursecrethere>&digits=8
Worked in both 1Password, as well as iCloud Keychain Passwords.
awesome. Much cleaner instructions are great for people!
@lightmaster Did you tick the “auth.authenticator” scope before trying to login? think I might have forgotten to add that in instructions.
As the app has certificate pinning i haven’t the time for look into more details, but it shouldn’t be hard to make an oauth auth like the app and get the client id.