How to get Facebook Sandbox Ad Account Data from my Application?
Asked Answered
W

1

6

I have added sandbox ad account in my app from FB Dev->Marketing API->Tools->Sandbox Ad Account Management . I have added 2 pages from my personal account and created campaigns and ads in there.

Now, I want this sandbox ad account data to test my .net application. But this sandbox account info doesn't show with

me/adaccounts

In Graph API Explorer, if sandbox's access token is given, it says it's 'not you' with providing another user id (api explorer result image here). How would i connect my app with the owner of this sandbox account? I am newbie here. Am i missing something? I couldn't find anything in facebook dev site regarding this.

Winona answered 25/10, 2017 at 15:3 Comment(1)
here is a screenshot of how it looks inside developer portal : ibb.co/fbhy6RExcoriation
E
3

I hope you have a flow to authenticate users, when they log in to facebook and then allow your app to access certain things, then facebook sends a callback to your app with access token and everything.

assuming you have the above flow setup, you can just log into facebook using your sandbox account and complete the flow for your app.

broken down simple steps :

  1. log in to facebook, go to developers.facebook.com -> app -> roles -> test users, pick a user, click edit, click change password.

  2. Go to your .net app and hit login with facebook or whatever you call your auth flow

  3. When prompted log in with sandbox credentials and the flow will perfectly give you an access token that you can use.

  4. That token can be used to do almost everything that you can do with a normal user token. use that token to get ad accounts or use token in graph api explorer.

In case you don't have auth flow, then you can get the token directly in step one instead of changing the password and use that in explorer.

Excoriation answered 27/10, 2017 at 7:5 Comment(1)
Thanks. It worked. Fb dev need some doc/tutorials regarding sandbox ad account.Winona

© 2022 - 2024 — McMap. All rights reserved.