fix(api): update Epic Games OAuth endpoints and response field names
Update OAuth endpoints to new public service URLs and adapt to camelCase response fields in device authorization response.
This commit is contained in:
parent
4e95f50bc4
commit
1cf4c86646
1 changed files with 7 additions and 7 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://api.epicgames.dev/epic/oauth/token', {
|
||||
const response = await axios.post('https://account-public-service-prod.ol.epicgames.com/account/api/oauth/token', {
|
||||
grant_type: 'urn:ietf:params:oauth:grant-type:device_code',
|
||||
device_code: deviceCode,
|
||||
client_id: '34a02cf8f4414e29b159cdd02e6184bd',
|
||||
|
|
@ -98,8 +98,8 @@ const getValidAuth = async ({ otpKey, reuseCookies, cookiesPath }) => {
|
|||
let deviceResponse;
|
||||
|
||||
try {
|
||||
deviceResponse = await axios.post('https://api.epicgames.dev/epic/oauth/deviceCode', {
|
||||
client_id: '34a02cf8f4414e29b159cdd02e6184bd',
|
||||
deviceResponse = await axios.post('https://account-public-service-prod.ol.epicgames.com/account/api/oauth/deviceAuthorization', {
|
||||
clientId: '34a02cf8f4414e29b159cdd02e6184bd',
|
||||
scope: 'account.basicprofile account.userentitlements',
|
||||
});
|
||||
} catch (error) {
|
||||
|
|
@ -107,11 +107,11 @@ const getValidAuth = async ({ otpKey, reuseCookies, cookiesPath }) => {
|
|||
return { bearerToken: null, cookies: [] };
|
||||
}
|
||||
|
||||
const { device_code, user_code, verification_uri_complete } = deviceResponse.data;
|
||||
console.log(`📱 Open: ${verification_uri_complete}`);
|
||||
console.log(`💳 Code: ${user_code}`);
|
||||
const { deviceCode, userCode, verificationUriComplete } = deviceResponse.data;
|
||||
console.log(`📱 Open: ${verificationUriComplete}`);
|
||||
console.log(`💳 Code: ${userCode}`);
|
||||
|
||||
const tokens = await pollForTokens(device_code);
|
||||
const tokens = await pollForTokens(deviceCode);
|
||||
|
||||
if (otpKey) {
|
||||
const totpCode = authenticator.generate(otpKey);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue