claabs/epicgames-freegames-node

Unable to get device authorization token

Closed this issue · 9 comments

I use docker to run the program. The log shows this error when logging in:

[2023-10-10 12:09:18.211 +0800] ERROR: Unable to get device authorization token
user: "xxxxx@xxxx.com"
err: {
"type": "Error",
"message": "Unable to get device authorization token",
"stack":
Error: Unable to get device authorization token
at DeviceLogin.waitForDeviceAuthorization (/usr/app/src/device-login.ts:309:15)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at DeviceLogin. (/usr/app/src/device-login.ts:190:36)
}

I get the same error.

By clicking the login link a second time or restarting the node and clicking login link again, I was able to bypass the error and eventually the cookie got successfully stored.

I'm having the same issue. Here's the 400 Bad Request response from EpicGames:

{
    "errorCode": "errors.com.epicgames.common.oauth.invalid_grant",
    "errorMessage": "invalid_grant",
    "messageVars": [],
    "numericErrorCode": 1012,
    "originatingService": "com.epicgames.account.public",
    "intent": "prod",
    "error_description": "invalid_grant",
    "error": "invalid_grant"
}
claabs commented

I think Epic Games disabled device code authorization for the fortnite client ID we were using. Not sure if there's another one available.

claabs commented

Updating the client used in your config.json might work. I scanned all the known clients and only this one (Diesel - Dauntless) got anywhere:

    "deviceAuthClientId": "b070f20729f84693b5d621c904fc5bc2",
    "deviceAuthSecret": "HG@XE&TGCxEJsgT#&_p2]=aRo#~>=>+c6PhR)zXP",

Something strange is happening on my local machine, so I'm not able to test it in full. Feel free to try it out though.

@claabs Thanks for looking into it. Unfortunately, I got the same error with this client.

I get the same error.

By clicking the login link a second time or restarting the node and clicking login link again, I was able to bypass the error and eventually the cookie got successfully stored.

I can repeatedly reproduce this behavior. The first login produces the "Unable to get device authentication token" error in the logs. However, using the same redirect link, in the same browser (auth-ed), a second time succeeds.

claabs commented

I was able to test a bunch of the auth clients, and the default one seems to still work fine for me. I updated the alternate values in the docs with the only other clients that worked as well: 1cae032

Note: If your network is poor (e.g. slow to open the device authorization verification link), you can appropriately increase the parameter deviceAuthPollRateSeconds, so that you can avoid aborting before you successfully log in by sending a request and getting a 400 error code. That works for me.

claabs commented

That's actually the root of the problem. This error was being returned, but not logged:

Request frequency should not exceed one call per 10 seconds

Changed the default poll rate in 4b3126e