I can't get the list of my test users with my app access token. First I get the app access token with the following graph api call:
https://graph.facebook.com/oauth/access_token?client_id=APP_ID&client_secret=APP_SECRET&grant_type=client_credentials
which succeeds, I get an access token in the format
APP_ID|SomeRandomCharacters
Now I try to get my list of test-users using the following graph API call:
https://graph.facebook.com/APP_ID/accounts/test-users?access_token=APP_ACCESS_TOKEN
however, I get a "bad URL" error in my iOS code.
If I try to go to that address directly in a browser I get HTTP 400 Bad Request and if I try it in the Graph API explorer, I get
{ "error":
{ "message": "An access token is required to request this resource.",
"type": "OAuthException",
"code": 104
}
}
Check your app isn't defined as 'Desktop/Native' - if it is, your app secret is considered untrusted for API calls that can change the app's settings (including Test Users)
The assumption is that the app secret has been distributed with your native app and can't be trusted.
Related
I am using the following graph api endpoint to seek the access token at the server side of my app for the given authorization code.
https://graph.accountkit.com/v1.1/access_token?grant_type=authorization_code&code=authorization_code&access_token=AA|facebook_app_id|app_secret
As mentioned in the Account kit docs for the access_token parameter I have concatenated the following:
"AA" + app id + app secret
Still I am getting Bad Request as response and following error is received:
"message": "Invalid OAuth access token.",
"type": "OAuthException",
"code": 190,
The error was that I was using my app_secret, there is a separate secret for account kit, that you can find in your Account Kit dashboard. Use that secret for making request
I'm trying to get videos of facebook page using facebook graph api.
I get it to work when I use my personal access facebook accounts access token but if I try to use my apps token it returns
{
"error": {
"message": "A user access token is required to request this resource.",
"type": "OAuthException",
"code": 102
}
}
Is there way to get pages public videos from the api by using app token?
If not, is there way to use just my personal access token and renewing it automatically without requiring the user to login. (Server would always make the request with MY OWN access token, not their)
At the moment, I try to query the Facebook Open Graph Api.
My problem is the following:
Calling: https://graph.facebook.com/endpoint?key=value&access_token=app_id|app_secret results in
{
"error": {
"message": "An access token is required to request this resource.",
"type": "OAuthException",
"code": 104
}
}
Also when I first receive an access token and use it, the same error appears. In the case, that I use an access token which I receive from the Graph API Explorer, everything works fine. https://developers.facebook.com/tools/explorer)
Comparing the access token I receive from Facebook and the access Token of the Graph API Explorer I see a difference in the length because the second token is much longer. (I think its a session token if I am not wrong)
How can I get such a token in order to do the mentioned API call?
Your appId and secret are used to generate your access_token, they aren't actually the token so there's something wrong with your process. Some sample code might help determine where you're going wrong. Though please don't actually post your appid and secret here.
https://developers.facebook.com/docs/facebook-login/overview/#loginflows
You haven't stated what language you are using, but there are a number of SDKs out there already that will simplify this process.
At the bottom of the above page, there are a number of links that will walk you through the login process for different platforms so I suggest you take a look at these
I'm trying to post the following the facebook Graph API explorer.
cody.short.94/notifications? access_token= {User Access Token} &template= this is a test &href= www.test.com
I want to be able to send the user a notification, but all attempts have failed. I'm currently getting this error:
{
"error": {
"message": "(#15) This method must be called with an app access_token.",
"type": "OAuthException",
"code": 15
}
}
I'm not sure what is causing it, and I'm in need of some guidance. Any help would be appreciated. note: my app is currently marked for web so that it not the problem
See, the error is quite self-explanatory :
This method must be called with an app access_token
The Notifications API use the APP Access Token, not the user access token!
The App Access Token is: APP_ID|APP_SECRET or get directly from here for testing. (Make sure of the security of this token, this is very crucial and just like a password to your app)
Now test the query with Graph API Explorer , and remove the user token from the Access token field and replace it with the App Access Token
It will look something like this-
Make sure you paste the app access token APP_ID|APP_SECRET on the top field that says Access Token
For some reason, I'm suddenly having trouble accessing my test users via the graph.
GETting this ...
https://graph.facebook.com/229607217115781/accounts/test-users&access_token=MYAPPACCESSTOKENHERE
Gives me:
{
"error": {
"message": "An access token is required to request this resource.",
"type": "OAuthException",
"code": 104
}
}
MYAPPACCESSTOKEN has been generated by calling
https://graph.facebook.com/oauth/access_token?client_id=MYAPPID&client_secret=SECRET&grant_type=client_credentials
and it returns the token just fine.
Looking at my git history, I'm pretty sure that this has worked before, making me suspect it's some breaking change I'm not aware of.
If your app is marked as a 'Desktop' app; you can't use the App Access Token for app administration via the API because it's assumed that you've distributed the app access token with the application binary and thus it can't be trusted as any of your users can decompile the app and get the app secret that way.
You can still use the Administration interface on developers.facebook.com for managing test users, or you can set your app back to 'Web' mode and the app secret will be usable for that call again