fix(api): update Epic Games OAuth endpoint and add missing Content-Type header
All checks were successful
build-and-push / lint (push) Successful in 8s
build-and-push / sonar (push) Successful in 20s
build-and-push / docker (push) Successful in 11s

Replace legacy OAuth token endpoint with new Epic Games API endpoint,
and add required Content-Type header for device authorization request
to comply with updated API expectations.
This commit is contained in:
nocci 2026-03-08 11:35:07 +00:00
parent 1cf4c86646
commit 84e50f07f2

View file

@ -47,7 +47,7 @@ const fetchFreeGamesAPI = async () => {
const pollForTokens = async (deviceCode, maxAttempts = 30) => {
for (let i = 0; i < maxAttempts; i++) {
try {
const response = await axios.post('https://account-public-service-prod.ol.epicgames.com/account/api/oauth/token', {
const response = await axios.post('https://api.epicgames.dev/epic/oauth/token', {
grant_type: 'urn:ietf:params:oauth:grant-type:device_code',
device_code: deviceCode,
client_id: '34a02cf8f4414e29b159cdd02e6184bd',
@ -101,6 +101,10 @@ const getValidAuth = async ({ otpKey, reuseCookies, cookiesPath }) => {
deviceResponse = await axios.post('https://account-public-service-prod.ol.epicgames.com/account/api/oauth/deviceAuthorization', {
clientId: '34a02cf8f4414e29b159cdd02e6184bd',
scope: 'account.basicprofile account.userentitlements',
}, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
});
} catch (error) {
console.error('Device code flow failed (fallback to manual login):', error.response?.status || error.message);
@ -398,3 +402,4 @@ export const claimEpicGamesNew = async () => {
export default claimEpicGamesNew;