I have tried getting extended user access token, but this user with following code
AccessToken accessToken =
new DefaultFacebookClient().obtainExtendedAccessToken(MY_APP_ID,
MY_APP_SECRET, MY_ACCESS_TOKEN);
this access token is having permission for only public profiles, I need an user access token with permission to ads_management ads_read and I am getting Exception while trying to get adaccounts:
{
"error":{
"message":"(#10) You do not have sufficient permissions to perform this action",
"type":"OAuthException",
"code":10,
"fbtrace_id":"GG27ChsELJV"
}
}
We are able to fetch user access token which provides ads_read access by default, if we get MY_ACCESS_TOKEN from admin(page admin).
AccessToken accessToken =
new DefaultFacebookClient().obtainExtendedAccessToken(MY_APP_ID,
MY_APP_SECRET, MY_ACCESS_TOKEN);