Частичное отключениеshare-external
Access Token right?
1

My app already has ads_read and ads_management access permissions. However, when I make the request:

const getAppAccessToken = async () => { const appId = process.env.FB_APP_ID; const clientSecret = process.env.FB_APP_SECRET; const accountId = process.env.FB_ACCOUNT_ID; const url = https://graph.facebook.com/oauth/access_token?client_id=${appId}&client_secret=${clientSecret}&grant_type=client_credentials; try { const response = await axios.get(url); const appAccessToken = response.data.access_token; console.log(appAccessToken); } catch (error) { console.error(error); } };

I get a token that doesn't seem to have any permissions, according to the FB debugger. I guess that's why I'm getting undefined in

const getAppAccessToken = async () => { const appId = process.env.FB_APP_ID; const clientSecret = process.env.FB_APP_SECRET; const accountId = process.env.FB_ACCOUNT_ID; const url = https://graph.facebook.com/oauth/access_token?client_id=${appId}&client_secret=${clientSecret}&grant_type=client_credentials; try { const response = await axios.get(url); const appAccessToken = response.data.access_token; console.log(appAccessToken);

const api = FacebookAdsApi.init(appAccessToken);
const account = new AdAccount(accountId);

console.log(account.age); // returns undefined

} catch (error) { console.error(error); } };

Can you help me understand why I can't access console.log(account.age)? Thanks!

Marcio
Вопрос задан около 2 мес. назад