Is it possible to change a test user's password so I can logon to any of my test users as normal so I can test my app properly?
I've tried :
https://graph.facebook.com/{user id}?password={newpassword}&method=post&access_token={the access token}
I got the access token from the Roles screen where all my test users are listed. The above link returns :
{
"error": {
"message": "Invalid OAuth access token.",
"type": "OAuthException"
}
}
What am I doing wrong? And is there another way to change the password?
I have 15 or so test users and I need to be able to log in as any of them. Only my main test user is registered with my app, the others are friends of the main test user (this is by design)
I tried creating lots of normal users to test with and quickly realised Facebook do their best to stop people doing this
Thanks
Yes - You can. However I have tried only manually - it works.
You have to be admin of application for which users You are editing
Go to FB Developers page -> Click 'Edit Roles'
At the bottom of the page there will be all users listed, each having option to set password next to its profile photo. Just Click and change.
Hope that helps a bit. As it is not a solution to set manually password for 25 users. But if it is not possible to do it manually then it won't be possible with API. worth to try, just to identify error.
Yes - creating real users for testing purposes is not an option
This is very Easy by using even APP Dashboard as follow
All though you can use Graph API for the same ,with User APP Access Toke or User access Token (If user ID is accessed) for this Process
Here is Python script of the same
For some reason, Facebook's documentation says that you should do an HTTP POST, but the example they show uses a query string, not post data.
Try submitting all query parameters as post data:
curl -H "Content-Type: application/x-www-form-urlencoded" \
--data "access_token=<facebook app access token>&method=post&name=<full user name>&password=<password>" \
-X POST 'https://graph.facebook.com/<facebook test user id>'
Related
What I want to do is to be able to create and publish FB ads from my fb account and publish it on other users fb pages using fb api.
User can install my app which will ask for manage_pages+business_management permission along with some other needed permissions.(this part is done for test app and it's working) and then users can create fb ads on my platform and connect there pages to the ad they have created.
I am able to create fb ads also from my platform but not able to connect users pages to my fb ads.
I have one main account with business manager + app(dev mode) connected to it + system users, test account etc..
so far I have figured out that I have to add the other fb user pages to my business pages and to do that according to the doc, first I have to install the app for system users by using below curl request.
https://developers.facebook.com/docs/marketing-api/businessmanager/systemuser/v2.10
Installing Apps
A system user or an admin system user must installĀ the appĀ that will be used for generating the token. That means to allow the app to call APIs on behalf of this system user or admind system user. Both system user and app should belong to a same business manager
To install an app for a system user you need following things:
* access_token: of an admin user, admin system user, or another system user if generated
* business_app: the app ID being installed
To install an application for system user, make a POST request as shown in the example below:
curl \
-F "business_app=APP_ID" \
-F "access_token=ACCESS_TOKEN" \
"https://graph.facebook.com/API_VERSION/APP_SCOPED_SYSTEM_USER_ID/applications"
This call will return a boolean result indicating installation was successful. If any of the restrictions are not met, you will see appropriate error message.
but it never works...
my first question is before going any further
Is it even possible to install the test app which is always in development mode for system users?
if the answer is "No" then i'll have make my main app live and submit it for review so I can needed permissions which are not there in main app which doesn't sound reasonable to me, I should be able to do this with test app in dev mode.
but if the answer is yes then please let me know how.
When I try I always get this error
Error: Requires business_management permission to manage the object
I have added system user to Advert account as an admin
I have added system user to test app as an admin
I checked business_management checkbox when I created the system user token
any help is highly appreciated!
ps: pls correct me if you think this is not the right way to achieve my goal
Well if someone comes around to this page for looking for an answer then it's damn simple, special privilege is required to do this and you'll have to contact facebook. it's that easy -_-, still haven't got the privilege yet so can't add anything else...
I would like to tweet via rest but I'm not sure what kind of OAuth I need.
https://dev.twitter.com/oauth/overview
There are plenty of OAuth types. But every time I see that user have to go to the web site and coppy pin(PIN-based OAuth) or go to the web page to sign in or click or something.
So my question is: is it possible to tweet something using only command-line application? (I dont like to use framekorks which are specially prepared for twitter like twitter4j etc)
If you just wanna post tweet from a command line then maybe https://github.com/sferik/t can help you. Regards
As documented here https://dev.twitter.com/rest/reference/post/statuses/update the endpoint to tweet requires authentication. For this you require a token tied to a specific user.
You have 2 options
1) Generate and store a token beforehand, this is the "Tokens from dev.twitter.com" option in the link you sent.
2) Ask a user to authenticate when you want to tweet for them. This is "3-legged OAuth" or "PIN-based OAuth". You can also then store this token for reuse, and switch between tokens in your own code to post as different users. But it generally relies on a user being logged into Twitter via a browser to click approve at some point before you want to tweet.
My project oksocial has support for either approach, after which you can post with
oksocial -d "status=my message to the world" https://api.twitter.com/1.1/statuses/home_timeline.json
or even specify the user token and client secrets on the command line
oksocial --token username,consumerKey,consumerSecret,token,secret -d "status=my message to the world" https://api.twitter.com/1.1/statuses/home_timeline.json
I want to make an application that runs in the background on a server, and syncs ad information from Facebook to a database on my server periodically (say once per hour).
The application will have no user interaction at all, meaning there is no user to click "I'm okay with Facebook using my info" every time you need to authenticate.
I found this in their docs: https://developers.facebook.com/docs/facebook-login/access-tokens#apptokens
The problem is, it doesn't seem to work. I can generate an access_token just fine. Example here:
$ curl 'https://graph.facebook.com/oauth/access_token?client_id=123456789012345&client_secret=s3cr3tt0k3n12a4zz1345a6fgx5aa3f6&grant_type=client_credentials'
access_token=123456789012345|SomeRandomLettersAndNumbers
However, when I go to use it I just get permission denied errors:
$ curl 'https://graph.facebook.com/v2.6/me/adaccounts?access_token=123456789012345|SomeRandomLettersAndNumbers'
{"error":{"message":"An active access token must be used to query information about the current user.","type":"OAuthException","code":2500,"fbtrace_id":"DQ8ysX2mHCu"}}
Same thing happens when I make the request via their explorer tool found here: https://developers.facebook.com/tools/explorer/
Notes:
I have an app set up.
I am the admin.
I claimed the app on my business account.
I created one ad account.
It is not a Native / Desktop app.
Important one: I can get the info if I use a user token instead of an app token, but this requires me to be on a website, and click through a popup window, which obviously I can't do every hour for my server-side app.
I'm not sure if I have to set the permissions somewhere to allow me to use the access token, or maybe I need to set up a "platform" for my app (none of the available ones seem to fit).
UPDATE:
The answer to this question is to use a system user as documented here: https://developers.facebook.com/ads/blog/post/2016/04/05/system-user-rollout/
Several people have asked how to post photos using an app token and the general response seems to be that they should use a user token instead.
However, according to https://developers.facebook.com/docs/concepts/login/access-tokens-and-types/ :
"[y]ou can use app tokens to publish or delete content on behalf of a user who gave your app permissions".
and according to https://developers.facebook.com/docs/reference/api/photo/ :
"To publish a 'photo' object you need
-a valid access token
-publish_stream permission
"
The way I interpret those two statements is that I should be able to POST a photo to .../USER_ID/photos using a valid APP token.
However, when I try to do that I get the message "A user access token is required to request this resource". At the same time I can easily publish to .../USER_ID/feed using nothing but the APP token. It is also possible to submit stories containing "User Generated Photos" with only an APP token.
So an App can do those things with an APP token, but needs a USER-specific token for .../USER_ID/photos? I wonder if this behavior is by design? So far I have not found anything in the documentation to indicate that is the case.
I too was stuck at the same point as mentioned. And the documentation barely helped.
The workaround I used was to take the 'offline_access' permission while logging in and storing that temporary user access token given to the user.
While publishing the photo I used that offline user access token since the app access token didn't work. It worked like it should've although offline_access has been discouraged to be used...it seemed to be the only way for now.
I am the owner of a facebook like page. I want to grab the news feed using php and output it on my website. I know that I can do this using a valid access token:
https://graph.facebook.com/my_app_id_here/feed?access_token=My_access_token_here
Problem access tokens expire so I know I need to authenticate periodically to get a new access token.
This is where the problem and confusion arises for me. When I read the authentication guide in the facebook dev docs all it talks about is first authenticating the user to get a authorization code from the user and then authenticating the app using the app secret, app id and auth code fromthe user. But this doesn't apply to my situation - I never have a authorization code form the user - all I'm trying to do is access the feed from a php script running on my server....a user is never involved.
Any ideas anyone?
User has to approve your application only once, and later use they can just access your app and use it without approving
Since you are the owner of the like page, I guess you are also the administrator. What you can do in this case is create an offline access token for this (and only for that) user.
You can then use this access token for your script. No user needs to authenticate anything if you only want to grab the feed of your page with the access token of your administrator.
This token never expires except for changing the user's password or taking away permissions again. Look at this answer to see how to create such an offline access token!
It seems offline_access is no longer available. Now you only get a short-lived access_token and you can ask for a long lived one, which is also renewable. You can't get a permanent one though.