开发者

How to share Amazon authenticated URL when posting to the wall using Facebook Graph API?

I am trying to create a Facebook wall post using Facebook Graph API. The payload is:

{ :message => 'I just uploaded image',
  :picture => 'http://s3.amazonaws.com/picyou-andrey-development/images/GejoFV/GejoFV.png?AWSAccessKeyId=AKIAI6ANFCV7RKOBGGBA&Signature=U0Bd2bMQ3Pai%2BAblVOimSOVcbzk%3D&Expires=1308771841',
  :link    => 'http://google.com',
  :name    => 'Test Post' }

The post is created properly but the problem in picture which does not displays at all.

When I was using public Amazon S3 URLs like http://s3.amazonaws.com/picyou-andrey-development/images/GejoFV/GejoFV.png picture was displayed correctly.

Any chance to use dynamic URLs as a 'picture' param with Facebook?

Thanks in advance.

Update:

Found a guy on the Facebook developer forum with exactly the same problem:

http://forum.developers.faceboo开发者_StackOverflowk.net/viewtopic.php?pid=302856


Could it be that the signature part of the url has some chararcters in it that have special meaning in urls - %2B (+) and %3D (=)?

I have run into a problem with these urls in some video players and solved it by making sure that the url doesn't have any of those characters. You can do this by generating the url in a loop and adding a second onto the expiry time everytime to ensure the signature changes. Repeat until the signature is 'valid'

psuedocode:

loop
    expiry = expiry + 1 second
    create url with expiry
until url is valid

In my experience it only takes an iteration or two for the url to be valid.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜