fix(api): update Epic Games OAuth endpoint and add missing Content-Type header
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:
parent
1cf4c86646
commit
84e50f07f2
1 changed files with 6 additions and 1 deletions
|
|
@ -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;
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue