开发者

Uploading Photos to Facebook using Graph API

开发者 https://www.devze.com 2023-02-06 12:40 出处:网络
I would like to provide users of my applica开发者_StackOverflow中文版tion with ability to upload photos to their Facebook account. The application has a username and password form for the users to fil

I would like to provide users of my applica开发者_StackOverflow中文版tion with ability to upload photos to their Facebook account. The application has a username and password form for the users to fill.

In Graph API, there's a method for uploading photos. But I'm unsure how to authenticate - it doesn't seem to provide a way to supply username and password. It requires access_token.

What's the right way to allow users authenticating and uploading photos using username and password?


It's hard to tell how you want to do this without a sample code or even stating what technology you are using..
Anyway, almost ALL interactions with facebook graph api require an access token and most likely an extended permission.

First of all, for you to post/upload a photo you need:

  1. The publish_stream extended permission
  2. A better understanding of how and where the photo will be uploaded to, this can be done by reading the publishing section in the photo documentation
  3. Now that you have a general idea, in your destination/submission page of your form and when the image is successfully uploaded to your server and it's location is known (obviously), use one of the two answers in this question to upload the image.

P.S: I don't really understand why you need a username & password in first place, but it's your application...


To clarify, the access_token is what you receive after the user authorize your application. So , the provision of username and password only need to be done once, when user first access your app. You need to redirect user browser or client to : https://www.facebook.com/dialog/oauth... (Refer to https://developers.facebook.com/docs/authentication/ )

Then after you have the access_token, you can just use that for the api call to upload photo to that user.

The authorization process need to be done again when the token is expired.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号