Revadike / epicgames-freebies-claimer

Claim available free game promotions from the Epic Games Store.
MIT License
2.23k stars 361 forks source link

Update/provide new method to get device_auths.json #127

Closed fatinghenji closed 2 years ago

fatinghenji commented 2 years ago

Current Behavior (if any)

  1. By using DeviceAuthGenerator.exe to get the file I should get.
  2. DeviceAuthGenerator.exe runs with an error.
  3. This issue has been raised in DeviceAuthGenerator-issue3, but has never been fixed.

    Desired Behavior

    Get the availabledevice_auths.json file

    Motivation / Use Case for Changing the Behavior

    Normal deployment and use of EpicGames Freebies Claimer

Revadike commented 2 years ago

Well, I am trying to adopt a native method, by using the fnbrjs library (check the fnbrjs branch), but I am struggling to implement it properly. I cannot figure out how to authenticate to the epic game store. The part I struggle with is generating cookies for the epic game store.

aneem commented 2 years ago

Note: This is a workaround i found which works. Its a bit tedious and manual at this point. 😔😔

The DeviceAuthGenerator throws error, however i was able to get the info required for device_auths.json by following the instructions here. These are the steps I followed:

  1. Ensure you are logged into epicgames with you account in ur browser
  2. Get authorization_code by opening this link in browser. The client id i've used is for fortniteIosClient.
  3. Get access code by using the authorization code from step 2.
    curl --location --request POST 'https://account-public-service-prod.ol.epicgames.com/account/api/oauth/token' \
    --header 'Authorization: Basic MzQ0NmNkNzI2OTRjNGE0NDg1ZDgxYjc3YWRiYjIxNDE6OTIwOWQ0YTVlMjVhNDU3ZmI5YjA3NDg5ZDMxM2I0MWE=' \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data-urlencode 'grant_type=authorization_code' \
    --data-urlencode 'code={{code_from_step_2}}'
  4. Use the access code from step 3 to get the details using the following curl
    curl --location --request POST 'https://account-public-service-prod.ol.epicgames.com/account/api/public/account/{{your_account_id}}/deviceAuth' \
    --header 'Authorization: Bearer {{bearer_token_from_step_3}}'
  5. You still need to manually store the response in the device_auths.json with your email as json key.

However even after doing so and creating the device_auths.json file, when running the claimer.js, it was still asking for exchange code. As a work around, i got the exchange code from following instructions here and tweaked the code in claimer.js as shown in the screenshot. image

Not sure if this is all the effort, but for someone who is looking for a quick fix this will work. Hope this helps!

jackblk commented 2 years ago

Wow I didn't know https://github.com/MixV2/EpicResearch exists. Thanks for document @aneem, it helps :).

I also have the same issue with DeviceAuthGenerator-issue3 and with the document, I think I fixed the issue. Will push a patch to my fork after I do more test.

jackblk commented 2 years ago

I fixed the issue with DeviceAuthGenerator here: https://github.com/xMistt/DeviceAuthGenerator/issues/3#issuecomment-924350309

I think we can continue to use this method to export the tokens.

Revadike commented 2 years ago

Well, if we can make the fnbrjs library working, we no longer have to rely on third party apps, or abandoned libraries. :)

stickerx commented 2 years ago

@Revadike after generating device_auths.json from my account keeps asking me to provide an exchange code for the email

?

Revadike commented 2 years ago

@Revadike after generating device_auths.json from my account keeps asking me to provide an exchange code for the email

?

Is it in the right folder?

stickerx commented 2 years ago

@Revadike yes data folder

fatinghenji commented 2 years ago

@Revadike after generating device_auths.json from my account keeps asking me to provide an exchange code for the email ?

Is it in the right folder? Experiencing the same problem The program prompts are as follows: To generate device auth, please provide an exchange code for the email:example@example.com screenshot of the error codes image

Revadike commented 2 years ago

Make sure all your installations are up-to-date. Please don't hijack this issue.