what I need: upload photos to user’s fan page as a page, using an app for that
what I have: my website which does uploading, and a user, who created fan page and application, and that app’s id and secret
what I do:
-
call
FB.init()with that appId -
call
FB.login()withmanage_pages,publish_streampermissions – this prompts FB login popup where user is asked to login and then to authenticate the app. As the result I get app access token. -
Send request to
https://graph.facebook.com/oauth/access_token?client_id=APP_ID&client_secret=APP_SECRET&grant_type=fb_exchange_token&fb_exchange_token=TOKEN_FROM_ABOVEto get extended app token valid for 2 months (and therefore page tokens will be extended as well as described here) -
Send request to
https://graph.facebook.com/me/accounts?access_token=TOKEN_FROM_ABOVEto get a list of pages user manages, and let user to choose the page he wants to publish to. -
That gives me PAGE access token I can use to publish photos to user’s FAN page using
/albumId/photos/API call.
what is the problem:
the “via” link in the photo redirects user to MY website (where user has authenticated his app to upload to his page): 
that is because I had to ask user to enter my website’s URL in app settings, otherwise Facebook login dialog will complain:

SO MY QUESTIONS ARE:
-
Am I doing this right? am I missing something probably?
-
If I am – then how can I get that “via” link to link to user’s website?
Thank you.
I ended up adding client’s website URL as a query string parameter into “Site URL” field in the application settings – and then I need to modify my site’s backend to do redirects: