From dd2038ac47e4d9c16b8a05cbde825f5d747d37ab Mon Sep 17 00:00:00 2001 From: Manuel Trezza <5673677+mtrezza@users.noreply.github.com> Date: Tue, 16 Dec 2025 02:11:06 +0100 Subject: [PATCH] fix --- spec/Adapters/Auth/instagram.spec.js | 25 +++++++++++++++++++++++++ src/Adapters/Auth/instagram.js | 3 +-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/spec/Adapters/Auth/instagram.spec.js b/spec/Adapters/Auth/instagram.spec.js index 441ef2b176..9b9fd27aa4 100644 --- a/spec/Adapters/Auth/instagram.spec.js +++ b/spec/Adapters/Auth/instagram.spec.js @@ -101,6 +101,31 @@ describe('InstagramAdapter', function () { 'Instagram auth is invalid for this user.' ); }); + + it('should ignore client-provided apiURL and use hardcoded endpoint', async () => { + const accessToken = 'mockAccessToken'; + const authData = { + id: 'mockUserId', + apiURL: 'https://example.com/', + }; + + mockFetch([ + { + url: 'https://graph.instagram.com/me?fields=id&access_token=mockAccessToken', + method: 'GET', + response: { + ok: true, + json: () => + Promise.resolve({ + id: 'mockUserId', + }), + }, + }, + ]); + + const user = await adapter.getUserFromAccessToken(accessToken, authData); + expect(user).toEqual({ id: 'mockUserId' }); + }); }); describe('InstagramAdapter E2E Test', function () { diff --git a/src/Adapters/Auth/instagram.js b/src/Adapters/Auth/instagram.js index 55cb357f6a..e1921597dd 100644 --- a/src/Adapters/Auth/instagram.js +++ b/src/Adapters/Auth/instagram.js @@ -96,8 +96,7 @@ class InstagramAdapter extends BaseAuthCodeAdapter { } async getUserFromAccessToken(accessToken, authData) { - const defaultURL = 'https://graph.instagram.com/'; - const apiURL = authData.apiURL || defaultURL; + const apiURL = 'https://graph.instagram.com/'; const path = `${apiURL}me?fields=id&access_token=${accessToken}`; const response = await fetch(path);